SQL WS
SQL WS
(i) Why is it not allowed to give string and date type argument for
Sum() and Avg() functions?
(ii) There is column C1 in a table T1.
The following two statements:
select count(*) from T1; and
select count(C1) from T1; are giving different output. What may be the possible
reason?
2 i) Which keyword is used to remove duplicate records from relation?
ii) A table "Design" in a database has 5 columns and 2 records. What is the
degree and cardinality of this table?
3. Differentiate between Primary Key and Foreign Key in RDBMS.
4. (i) Write the SQL Command to display all the rows from a table.
(ii) If there are ‘m’ rows in table-1 and ‘n’ rows in table-2, then how many
rows will be present in the Cartesian product of both the tables?
5.In MYSQL database, if a table, SCHOOL has degree 4 and cardinality 5, and
another table,STUDENT has degree 4 and cardinality 3,What will be the degree
and cardinality of the Cartesian product of SCHOOL and STUDENT?
a) 4,5 b)4,3 c)8,15 d)16,8
6.Which is not a constraint in SQL?
a) unique b)distinct c)Primary key d)Check
7.Choose the correct command to delete an attribute gender from a relation
student.
a)ALTER TABLE student DELETE gender
b)ALTER TABLE student DROP gender
c)ALTER TABLE DROP gender FROM student
d)DELETE gender FROM student8.Ms.Sita has just created a table named
“sweets” containing columns Sname, Quantity and Price.
After creating the table, she realized that she has forgotten to add a primary
key column in the table. Help her in writing an SQL command to add a primary
key column SID of integer type to the table sweets. Thereafter, write the
command to insert the following record in the table: SID- 999
SECTION B