12 Cs SQL Home Test - 3
12 Cs SQL Home Test - 3
HOME TEST-3
SQL REVISION –PART I
1.Which of the following commands will delete the table from MYSQL
database?
(a) DELETE TABLE (b) DROP TABLE (c) REMOVE TABLE (d) ALTER TABLE
2. A SQL table BOOKS contains the following column names: BOOKNO, BOOKNAME,
QUANTITY, PRICE, AUTHOR Write the SQL statement to add a new column REVIEW to
store the reviews of the book.
3. Write the names of any two commands of DDL and any two commands of DML in SQL.
4. Differentiate between count() and count(*) functions in SQL with appropriate example.
OR
Categorize the following commands as DDL or DML: INSERT, UPDATE, ALTER, DROP
5.Rashmi has forgotten the names of the databases,tables and the structure of the tables that
she had created in Relational Database Management System (RDBMS) on her computer.
a) Write the SQL statement to display the names of all the databases present in RDBMS
application on her computer.
b) Write the statement which she should execute to open the database named "STOCK"
c) Write the statement which she should execute to display the structure of the table
"ITEMS" existing in the above opened database "STOCK".
6.Navdeep creates a table RESULT with a set of records to maintain the marks secured by
students in Sem 1, Sem2, Sem3 and their division. After creation of the table, he has entered
data of 7 students in the table.
Based on the data given above answer the following questions:
(i) Identify the most appropriate column, which can be considered as Primary key.
(ii) If two columns are added and 2 rows are deleted from the table result, what will be the
new degree and cardinality of the above table?
(iii) Write the statements to:
a. Insert the following record into the table
Roll No- 108, Name- Aadit, Sem1- 470, Sem2-444, Sem3-475, Div – I.
b. Increase the SEM2 marks of the students by 3% whose name begins with ‘N’.
c. Write the statements to: a. Delete the record of students securing IV division.
d. Add a column REMARKS in the table with datatype as varchar with 50 characters