1. Which command is used to change the number of columns in a table?
2. Which keyword is used to select rows containing column that match a wildcard pattern?
3. Differentiate between Degree and Cardinality.
4. An aggregate function count all except ignore null values in their input collection.
5. Group functions can be applied to any numeric values, some text types and DATE values.(T/F)
6. Which command is used to change the existing information of table?
7. Expand the term: RDBMS
8. Write an Aggregate function that is used in MySQL to find No. of Rows in the database Table
9. For each attribute of a relation, there is a set of permitted values, called the of that attribute is
called ________
10. In SQL, write the query to display the list of databases stored in MySQL.
11. Which command is used to see the structure of the table/relation.
12. A virtual table is called a .............
13. Which clause is used to remove the duplicating rows of the table?
14. Which clause is used in query to place the condition on groups in MySql?
15. Which command is used for counting the number of rows in a database?
16. In SQL, name the clause that is used to place condition on groups
17. In SQL, which command is used to change the structure of already created table.
18. Which operator performs pattern matching in SQL?
19. What does the following function result into? count(field_name)
20. In SQL, what are aggregate functions?
21. How many Primary and Foreign keys can a table have?
22. In SQL, write the name of the aggregate function which is used to calculate & display the
average of numeric values in an attribute of a relation.
23. Write an SQL query to display all the attributes of a relation named “TEST” along with their
description.
24. What is the use of LIKE keyword in SQL?
25. What is the purpose of following SQL command: SHOW DATABASES;
26. Identify the error in the following SQL query which is expected to delete all rows of a table TEMP
without deleting its structure and write the correct one:
DELETE TABLE TEMP;
27. In SQL, name the command/clause that is used to display the rows in descending order of a
column.
28. In SQL, what is the error in following query :
SELECT NAME, SAL, DESIGNATION WHERE DISCOUNT=NULL;
29. Write any two aggregate functions used in SQL.
30. In SQL, write the query to display the list of databases.
31. A non-key attribute, whose values are derived from primary key of some other table.
32. Identify the DDL Command.
(i) Insert (ii) Create (iii) Drop (iv) Delete command
33. Which of the following will suppress the entry of duplicate value in a column?
34. a) Unique b) Distinct c) Primary Key d) NOT NULL
35. Which of the following is a DML command?
36. a) SELECT b) Update c) INSERT d) All
37. Which clause is used with a SELECT command in SQL to display the records in ascending order of
an attribute?
38. A relation has 45 tuples & 5 attributes, what will be the Degree & Cardinality of that relation?
39. In SQL, which aggregate function is used to count all records of a table?
40. Anita is executing sql query but not getting the appropriate output, help her to do the
correction.
41. Select name from teacher where subject=Null;
42. Sunita executes following two statements but got the variation in result 6 and 5 why?
(i) select count(*) from user ;
(ii) select count(name) from user ;
43. What is the difference between where and having in SQL.
44. Write a command to add new column marks in table ‘student’ data type int.
45. Write query to display the structure of table teacher.
46. In SQL, what is the use of BETWEEN operator?
47. In SQL, name the clause that is used to display the tuples in ascending order of an attribute.
48. In SQL, what is the use of IS NULL operator?
49. Write any one aggregate function used in SQL.
50. In SQL, write the query to display the list of tables stored in a database
51. Which is known as range operator in MySQL.
52. If column “salary” of table “EMP” contains the dataset {10000, 15000, 25000, 10000, 25000},
53. what will be the output of following SQL statement?
54. SELECT SUM(DISTINCT SALARY) FROM EMP;
55. Which function is used to find the largest value from the given data in MySQL?
56. Name the clause used in query to place the condition on groups in MySQL?
57. Write SQL statement to find total number of records in table EMP?
58. In SQL, name of the keyword used to display unique values of an attribute.
59. In SQL, what is the use of ORDER BY clause?
60. Write the function used in SQL to display current date
61. In SQL, write the command / query to display the structure of table ‘emp’ stored in a database.
62. In SQL, name the clause that is used to display the unique values of an attribute of a table.
63. In SQL, what is the use of <> operator?
64. Write any two aggregate function used in SQL
65. Which of the following types of table constraints will not prevent NULL entries in a table?
66. a) Unique b) Distinct c) Primary Key d) NOT NULL
70.
71. Modern Public School is maintaining fees records of students. The database administrator Aman
decided that- • Name of the database -School
• Name of the table – Fees
• The attributes of Fees are as follows:
Rollno - numeric Name – character of size 20
Class - character of size 20
Fees – Numeric
Qtr – Numeric
(i) Identify the attribute best suitable to be declared as a primary key
(ii) Write the degree of the table.
(iii) Insert the following data into the attributes Rollno, Name, Class, Fees and Qtr in fees table.
(iv) Aman want to remove the table Fees table from the database School. Which command will he use
from the following:
a) DELETE FROM Fees;
b) DROP TABLE Fees;
c) DROP DATABASE Fees;
d) DELETE Fees FROM Fees;
(v) Now Aman wants to display the structure of the table Fees, i.e, name of the attributes and their
respective data types that he has used in the table. Write the query to display the same.
72.
73.
i. To display all information about teachers of Female PGT Teachers.
ii. To list names, departments and date of hiring of all the teachers in descending order of date of joining.
iii. To count the number of teachers and sum of their salary department wise.
74.
75.
76.
(a) Identify the attribute best suitable to be declared as a primary key,
(b) If Administrator adds two more attributes in the table MEDICINE then what will be the degree and
cardinality of the table MEDICINE.
(c) Administrator wants to update the content of the row whose
ino is 1003 as , iname = “Paracetamol Tablet ” mcode = 25 and qty = 100
(d) Administrator wants to remove the table MEDICINE from the database medstore . Which command
will he use?
(e) Now Administrator wants to display only unique code of the table MEDICINE . Write the query to
display the same
77.
Observe the table named “Training” given above carefully and predict the output of the
following queries:
i. select city from training where topic = 'Cyber Security';
ii. select count(Training_Id) from training where email_id like '%gmail% ';
iii. select AVG (Fee) from training where Topic = 'Cyber Security';
iv. select name from training where INSTR (Email_Id, '@’)=0;
78.
79. Write SQL query to create a table “BOOKS” with the following structure: