[go: up one dir, main page]

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

Revision Worksheet 1

The document is a revision worksheet focused on SQL concepts, including datatype differentiation, command types, and functions. It includes tasks such as defining terms related to relations, writing SQL queries based on an EMPLOYEES relation, and matching SQL clauses with their functions. Additionally, it requires analyzing and correcting SQL statements for displaying employee data and product records.
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)
15 views2 pages

Revision Worksheet 1

The document is a revision worksheet focused on SQL concepts, including datatype differentiation, command types, and functions. It includes tasks such as defining terms related to relations, writing SQL queries based on an EMPLOYEES relation, and matching SQL clauses with their functions. Additionally, it requires analyzing and correcting SQL statements for displaying employee data and product records.
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
You are on page 1/ 2

Revision Worksheet -1

1. Differentiate between
(i) Char( ) and Varchar( ) datatype in SQL.
(ii) DDL and DML commands in SQL.
(iii) ROUND() and TRUNCATE() functions
(iv) DROP and DELETE command
(v) ORDER BY and GROUP BY clause
(vi) Candidate Key and Alternate Key
2. Define the terms and label it in a relation.
(i) Entity
(ii) Degree
(iii) Cardinality
(iv) Tuple
(v) Attribute
(vi) Domain
(vii) Candidate Key
(viii) Primary Key
(ix) Alternate Key
3. Write output for the following statements
(i) SELECT ROUND (37126.23 , -3) ;
(ii) SELECT POW (4 , -3);
(iii) SELECT MOD (17 ,5);
(iv) SELECT TRUNCATE(389.23,2);
(v) SELECT MOD(10.5,3);
4. Write SQL commands on the basis of EMPLOYEES relation given below:

EMP_CODE EMP_NAME DEPT SALARY DOJ WORK EXP.


E001 RIMPI FINANCE 55000 22-05-2023 5
E002 VIVEK IT 63000 23-02-2022 6
E003 ANIKA SALES 78000 05-03-2019 5
E004 MANVI HR 52000 06-01-2024 2
E005 SHREYAS HR 45000 01-01-2022 2

a) To show details of all employees with experience more than 2 years.


b) To list the employees whose salary is more than 50000.
c) To find incentives of the employees where incentive is 10% of their salary.
5. I need to display Employees name according to their Salary and I am using the below statement.
Analyse the SQL statement, rectify the errors and write the correct statement.
SELECT EMP_NAME ,SUM(SALARY) “TOTAL SALARY” FROM EMPLOYEE GROUP BY EMP_NAME WHERE
SUM(SALARY) > 30000;
6. Write SQL queries to perform following based on the table PRODUCT having fields as
(prod_id,prod_name,quantity,unit_rate,price,city)
a) Display those records from table PRODUCT where prod_id is more than 100.
b) List records from table PRODUCT where prod_name is ‘Keyboard’.
c) List all those records whose price is between 300 and 500.
d) Display the product names whose quantity is not given.
e) Show the detailed records in the table PRODUCT.
7. Match the following clauses with their respective functions-
ALTER Insert the values in a table
UPDATE Restrictions on columns
DELETE Table Definition
INSERT INTO Change the name of a column
CONSTRAINTS Update existing information in a table
DESCRIBE Delete an existing row from a table
CREATE Create a database

You might also like