Give output for following SQL queries as per given table(s):
SELECT FIRSTNAME, SALARY FROM EMPLOYEES, EMPSALARY WHERE DESIGNATION = 'Salesman' AND EMPLOYEES.EMPID = EMPSALARY.EMPID;
SELECT COUNT(DISTINCT DESIGNATION) FROM EMPSALARY;
SELECT DESIGNATION, SUM(SALARY) FROM EMPSALARY GROUP BY DESIGNATION HAVING COUNT(*) > 2;
SELECT SUM(BENEFITS) FROM EMPLOYEES WHERE DESIGNATION = 'Clerk';
Consider the following tables RESORT and OWNEDBY and answer the questions (a) and (b) parts of this question:
Table: RESORT
RCODE | PLACE | RENT | TYPE | STARTDATE |
R001 | GOA | 15000 | 5 STAR | 12-Jan-02 |
R002 | HIMACHAL | 9000 | 4 STAR | 20-Dec-07 |
R003 | KERALA | 12500 | 5 STAR | 10-Mar-06 |
R004 | HIMACHAL | 10500 | 2 STAR | 25-Nov-05 |
R005 | GUJARAT | 8000 | 4 STAR | 01-Jan-03 |
R006 | GOA | 18000 | 7 STAR | 30-Mar-08 |
R007 | ORISSA | 7500 | 2 STAR | 12-Apr-99 |
R008 | KERALA | 11000 | 5 STAR | 03-Mar-03 |
R009 | HIMACHAL | 9000 | 2 STAR | 15-Oct-08 |
R010 | GOA | 13000 | 5 STAR | 12-APR-06 |
Table: OWNEDBY
Place C | OWNER |
GOA | RAJ RESORTS |
KERALA | KTDC |
HIMACHAL | HTDC |
GUJARAT | MAHINDRA RESORTS |
ORISSA | OTDC |
Which of the following is not a valid DML command in SQL?
Write SQL queries for (i) to (vii) on the basis of table ITEMS and TRADERS:
b. SELECT PRICE*QTY FROM ITEMS WHERE CODE=1004;
c. SELECT DISTINCT TCODE FROM ITEMS;
d. SELECT INAME, TNAME FROM ITEMS I, TRADERS T WHERE I.TCODE=T.TCODE AND QTY<100;
Which of the following commands in SQL is used to add a new record into a table?
What is a relation?
What is the difference between a tuple and an attribute?
Consider the following tables CARDEN and CUSTOMER and answer the following parts of this question :
Table: CARDEN
Ccode | CarName | Make | Color | Capacity | Charges |
501 | A-Star | Suzuki | RED | 3 | 14 |
503 | Indigo | Tata | SILVER | 3 | 12 |
502 | Innova | Toyota | WHITE | 7 | 15 |
509 | SX4 | Suzuki | SILVER | 4 | 14 |
510 | C Class | Mercedes | RED | 4 | 35 |
Table: CUSTOMER
CCode | Cname | Ccode |
1001 | Hemant Sahu | 501 |
1002 | Raj Lai | 509 |
1003 | Feroza Shah | 503 |
1004 | Ketan Dhal | 502 |
Give the output of the following SQL queries :
Consider the following tables GAMES and PLAYER and answer (b) and (c) parts of this question:
Table: GAMES
GCode | Game Name | Type | Number | Prize Money | Schedule Date |
101 | Carom Board | Indoor | 2 | 5000 | 23-Jan-2004 |
102 | Badminton | Outdoor | 2 | 12000 | 12-Dec-2003 |
103 | Table Tennis | Indoor | 4 | 8000 | 14-Feb-2004 |
105 | Chess | Indoor | 2 | 9000 | 01-Jan-2004 |
108 | Lawn Tennis | Outdoor | 4 | 25000 | 19-Mar-2004 |
Table: PLAYER
PCode | Name | GCode |
1 | Nabi Ahmad | 101 |
2 | Ravi Sahai | 108 |
3 | Jatin | 101 |
4 | Nazneen | 103 |
Consider the following table BATSMEN:
Table: BATSMEN
PNO | NAME | SCORE |
P1 | RISHABH | 52 |
P2 | HUSSAIN | 45 |
P3 | ARNOLD | 23 |
P4 | ARNAV | 18 |
P5 | GURSHARAN | 52 |
Identify and write the name of the Candidate Keys in the given table BATSMEN.
How many tuples are there in the given table BATSMEN?
Consider the following tables CARDEN and CUSTOMER. Write SQL commands for the following statements.
Table: CARDEN
Ccode | CarName | Make | Color | Capacity | Charges |
501 | A-Star | Suzuki | RED | 3 | 14 |
503 | Indigo | Tata | SILVER | 3 | 12 |
502 | Innova | Toyota | WHITE | 7 | 15 |
509 | SX4 | Suzuki | SILVER | 4 | 14 |
510 | C Class | Mercedes | RED | 4 | 35 |
Table: CUSTOMER
CCode | Cname | Ccode |
1001 | Hemant Sahu | 501 |
1002 | Raj Lai | 509 |
1003 | Feroza Shah | 503 |
1004 | Ketan Dhal | 502 |