1.

Based on the following table, what is the output of the SQL query:

Table: STUDENT

ID NAME ADDRESS
01 Bob Chicago
03 John New York
05 Alice Boston
02 Tara Seattle
04 Ben Chicago
06 Mike New York
 
SQL > SELECT COUNT (*) FROM (SELECT DISTINCT ADDRESS FROM STUDENT);
2.

Based on the following table, what is the output of the SQL query:

Table: Student

Reg No Name Address
1 John Seattle
2 Bob Chicago
3 Mary Boston
 
SQL > DELETE FROM STUDENT;
3.

Based on the following table, what is the output of the SQL query:

STUDENT

ID NAME AGE
015 Bob 20
020 Alice 18
105 Mike 25
151 Tara NULL
 
SQL > ALTER TABLE STUDENT DROP COLUMN AGE;
4.

Based on the following table, what is the output of the following SQL query:

STUDENT

ID NAME AGE
15 Mike 20
20 Bob 18
105 Tara 25
151 Mary NULL
 
SQL > SELECT ID FROM STUDENT WHERE ID LIKE '_5';
5.

Based on the following table, what is the output of the SQL query:

Table: STUDENT

ID NAME AGE
015 Bob 20
020 Alice 18
105 Mike 25
151 Tara NULL
 
SQL > ALTER TABLE STUDENT RENAME TO S1;
6.

Based on the following table, what is the output of these SQL query:

Table: EMPLOYEE

ID NAME DEPT_ID SALARY
01 Bob 10 5000
03 Ben 20 1000
05 Mike 10 7000
02 Tara 30 3000
04 Anita 20 2000
 
SQL > SELECT SUM (SALARY) FROM EMPLOYEE GROUP BY DEPT_ID;
7.

Based on the following tables, what is the output of the SQL query:

Table: PRODUCT1

PID NAME
100 Samsung
200 Nokia
400 LG

Table: PRODUCT2

SL No PID NAME
1 200 Sony
2 300 Microsoft
3 400 Apple
 
SQL > SELECT PID FROM PRODUCT1 UNION ALL SELECT PID
FROM PRODUCT2 ORDER BY PID;
8.

Based on the following tables, what is the output of the SQL query:

CUSTOMER

CUSTID NAME
4000 Mike
5000 Tara
6000 Alice
7000 Bob
8000 Mary
9000 John

ORDER

ORDERID CUSTID DATE
1 7000 2016/04/17
2 5000 2016/03/17
3 8000 2016/03/29
4 4000 2016/04/25
 
SQL > SELECT NAME FROM CUSTOMER WHERE EXISTS (SELECT * FROM ORDER
   WHERE CUSTOMER.CUSTID = ORDER.CUSTID)ORDER BY NAME;
9.

Based on the following table, what is the output of the SQL query:

Table: STUDENT

ID (Primary key) NAME AGE
015 Bob 20
020 Alice 18
105 Mike 25
151 Tara NULL
 
SQL > ALTER TABLE STUDENT DROP PRIMARY KEY;
10.

Based on the following table, what is the output of the SQL query:

Table: EMPLOYEE

ID NAME AGE SALARY
01 Bob 24 15000
03 John 23 10000
05 Alice 28 15000
02 Tara 26 NULL
04 Ben 29 20000
 
SQL > SELECT DISTINCT SALARY FROM EMPLOYEE ORDER BY SALARY;