SQL
SQL
How many
Candidate keys will this table have?
(A) 1
(B) 2
(C) 3
(D) 4
(C) 3
3 In which datatype the value stored is padded with spaces to fit the specified length. (A) DATE
(B) VARCHAR (C) FLOAT (D) CHAR
(D) CHAR
4 Which aggregate function can be used to find the cardinality of a table? (A) sum() (B) count()
(C) avg() (D) max()
(B) count()
5 Assertion (A): A SELECT command in SQL can have both WHERE and HAVING clauses.
Reasoning (R): WHERE and HAVING clauses are used to check conditions, therefore, these
can be used interchangeably.
6 A) What constraint should be applied on a table column so that duplicate values are not
allowed in that column, but NULL is allowed.
OR
B) What constraint should be applied on a table column so that NULL is not allowed in that
column, but duplicate values are allowed.
7. A) Write an SQL command to remove the Primary Key constraint from a table, named
MOBILE. M_ID is the primary key of the table.
OR
B) Write an SQL command to make the column M_ID the Primary Key of an already existing
table, named MOBILE.
IV) Display the sum of Price of all the orders for which the quantity is null.
(I) select Product, sum(Quantity) from orders group by product having sum(Quantity)>=5;
(II) select * from orders order by Price desc;
(III) select distinct C_Name from orders;
(IV) select sum(price) as total_price from orders where Quantity IS NULL;
(IV) (A) Select FName, LName from faculty natural join courses where Came="System
Design";
Or Select FName, LName from faculty, courses where Came="System Design" and
facuty.f_id=courses.f_id;