DDL DML Commands-Ece-A1
DDL DML Commands-Ece-A1
Data Manipulation Language (DML) is a subset of SQL commands used for adding
(inserting), deleting, and modifying (updating) data in a database. DML commands are
crucial for managing the data within the tables of a database. The primary DML commands in
SQL include:
Data Control Language (DCL) is a subset of SQL commands used to control access to data in
a database. DCL is crucial for ensuring security and proper data management, especially in
multi-user database environments. The primary DCL commands in SQL include:
Questions:
USE the following schema and write the 5 rows of valid data for each table.
Emp(emp_id, fname,lname,job_title,salary, proj_id)
Project(proj_id, proj_name,proj_location)
Department(dept_num,dept_name,dept_location)
1. Create a dummy table and rename it
2. Update the employee first name whose name starts with letter ‘s’
Hint: to search any string value you may use like ‘%character’
Here the character represents any symbol/alphabet/digit and ‘%’ indicates any
number of characters in the search string of any length.
For ex1: to search an employee id whose name ends with letter ‘a’
Query: select emp_id from EMPLOYEE where name like ’%a’
For ex2: to search an employee id whose name ends with letter ‘a’
Query: select emp_id from EMPLOYEE where name like ’a%’
For ex3
: to search an employee id whose name contains the letter ‘a’
Query: select emp_id from EMPLOYEE where name like ’%a%’
For ex5: to search an employee id whose length of name is 5 characters and contains
letter ‘d’
Query: select emp_id from employee where name like ‘_%d%_’
3. Update the employee firstname whose name ends with letter ‘a’
4. Hike all employees salaries to 10000, who are drawing salary greater than 50000.
5. Delete the employee records whose salary value is null
6. Add a new column ‘favorite color’ to employee table.
7. Insert the data to newly added column
8. Retrieve all employees details who belong to department ‘IT’
9. Retrieve all employees id and names whose dept number is 100
10. Get all project details whose location is ‘mumbai’
11. Get all project names that belong to ‘cse’ dept
12. Get the dependent details when emp id is given
13. Update all project locations to Mumbai whose current location is Hyderabad.
14. Delete all rows of data of any table(you may create a dummy table), but not the
schema.