0% found this document useful (0 votes)
5 views2 pages

SQL Commands and Outputs Explained

The document provides SQL commands for querying a WORKER table, including displaying worker names, filtering by PLEVEL, and inserting new rows. It also presents the output of various SQL queries, showing counts of PLEVELs, maximum and minimum dates, and specific worker pay details. Overall, it illustrates how to manipulate and retrieve data from a SQL database effectively.

Uploaded by

dofow84049
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

SQL Commands and Outputs Explained

The document provides SQL commands for querying a WORKER table, including displaying worker names, filtering by PLEVEL, and inserting new rows. It also presents the output of various SQL queries, showing counts of PLEVELs, maximum and minimum dates, and specific worker pay details. Overall, it illustrates how to manipulate and retrieve data from a SQL database effectively.

Uploaded by

dofow84049
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SQL Commands and their Output (Based on your SQL table examples)

(a) SQL commands:

1. To display the name of all Workers in descending order of DOB:

SELECT Name FROM WORKER ORDER BY DOB DESC;

2. To display Name and DESIGN of those Workers, whose PLEVEL is either P001 or P003:

SELECT Name, Design FROM WORKER WHERE PLEVEL IN ('P001', 'P003');

3. To display the content of all workers whose DOB is between '19-Jan-1984' and '18-Jan-1987':

SELECT * FROM WORKER WHERE DOB BETWEEN '1984-01-19' AND '1987-01-18';

4. To add a new row to WORKER:

INSERT INTO WORKER VALUES (19, 'Daya Kishore', 'Operator', 'P003', '2008-09-19',

'1984-07-11');

(b) Output of the SQL queries:

1. SELECT COUNT (PLEVEL), PLEVEL FROM WORKER GROUP BY PLEVEL;

| COUNT(PLEVEL) | PLEVEL |

|---------------|--------|

|2 | P001 |

|2 | P002 |

|1 | P003 |

2. SELECT MAX(DOB), MIN(DOJ) FROM WORKER;

| MAX(DOB) | MIN(DOJ) |
|------------|------------|

| 23-Aug-1981| 13-Sep-2004|

3. SELECT NAME, PAY FROM WORKER, PAYLEVEL WHERE

[Link]=[Link] AND ECODE=13;

| NAME | PAY |

|--------------|--------|

| Ameen Ahmed | 22000 |

4. SELECT PLEVEL, PAYLEVEL WHERE PLEVEL='P003';

| PLEVEL | PAY | ALLOWANCE |

|--------|--------|-----------|

| P003 | 12000 | 6000 |

You might also like