Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
12 views7 pages

DBMS Lab

The document outlines the creation and manipulation of database tables including Employee, Departments, Customer, and Salgrade. It details various SQL operations such as inserting values, updating data, selecting records based on conditions, and using aggregate functions. Additionally, it covers advanced SQL concepts like creating views, joining tables, and using subqueries.

Uploaded by

Sahana M.k
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)
12 views7 pages

DBMS Lab

The document outlines the creation and manipulation of database tables including Employee, Departments, Customer, and Salgrade. It details various SQL operations such as inserting values, updating data, selecting records based on conditions, and using aggregate functions. Additionally, it covers advanced SQL concepts like creating views, joining tables, and using subqueries.

Uploaded by

Sahana M.k
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/ 7

• Create a table:

1. Employee(emp_id, first_name, last_name, job_id, doj, salary, dept_id, manager_id)


2. Departments(dept_id, dept_name, manager_id)
3. Customer(cust_id, first_name, last_name, address, city, phone, email)
4. Salgrade(grade, highsal, lowsal)

• Insert 5 values each

1. Insert data using another table


2. Insert specific columns
3. Update data using another table
4. Select data from one table based on another
5. Add a new column to a table

• Create a table:

1. Employee(emp_id, first_name, last_name, job_id, doj, salary, dept_id, manager_id)


2. Departments(dept_id, dept_name, manager_id)
3. Customer(cust_id, first_name, last_name, address, city, phone, email)
4. Salgrade(grade, highsal, lowsal)

• Insert 5 values each

1. Modify the data type of a column


2. Rename a column
3. Rename a table
4. Update values
5. Delete specific rows
• Create a table:

1. Employee(emp_id, first_name, last_name, job_id, doj, salary, dept_id, manager_id)


2. Departments(dept_id, dept_name, manager_id)
3. Customer(cust_id, first_name, last_name, address, city, phone, email)
4. Salgrade(grade, highsal, lowsal)

• Insert 5 values each

1. Select employees with salary more than 45000


2. Select employees from a specific departments
3. Select employees who joined after a specific date
4. Use AND/OR operators
5. IN, BETWEEN, LIKE examples

• Create a table:

1. Employee(emp_id, first_name, last_name, job_id, doj, salary, dept_id, manager_id)


2. Departments(dept_id, dept_name, manager_id)
3. Customer(cust_id, first_name, last_name, address, city, phone, email)
4. Salgrade(grade, highsal, lowsal)

• Insert 5 values each

1. IS NULL/IS NOT NULL


2. Add primary key
3. Add unique key
4. Add foreign key
5. Drop keys (primary, unique and foreign)
• Create a table:

1. Employee(emp_id, first_name, last_name, job_id, doj, salary, dept_id, manager_id)


2. Departments(dept_id, dept_name, manager_id)
3. Customer(cust_id, first_name, last_name, address, city, phone, email)
4. Salgrade(grade, highsal, lowsal)

• Insert 5 values each

1. Match characters using LIKE


2. Match characters anywhere
3. Find NULL values
4. Match ending characters
5. Simple comparison(salary>50000)

• Create a table:

1. Employee(emp_id, first_name, last_name, job_id, doj, salary, dept_id, manager_id)


2. Departments(dept_id, dept_name, manager_id)
3. Customer(cust_id, first_name, last_name, address, city, phone, email)
4. Salgrade(grade, highsal, lowsal)

• Insert 5 values each

1. BETWEEN clause(salary between 30000 to 60000)


2. Set comparison using IN
3. NOT IN clause
4. First_name starts with ‘A’
5. Address contains ‘main road’
• Create a table:

1. Employee(emp_id, first_name, last_name, job_id, doj, salary, dept_id, manager_id)


2. Departments(dept_id, dept_name, manager_id)
3. Customer(cust_id, first_name, last_name, address, city, phone, email)
4. Salgrade(grade, highsal, lowsal)

• Insert 5 values each

1. Manager_id IS NULL
2. Last_name ends with ‘son’
3. COUNT – total number of employees
4. SUM – Total salary paid
5. AVG – average salary

• Create a table:

1. Employee(emp_id, first_name, last_name, job_id, doj, salary, dept_id, manager_id)


2. Departments(dept_id, dept_name, manager_id)
3. Customer(cust_id, first_name, last_name, address, city, phone, email)
4. Salgrade(grade, highsal, lowsal)

• Insert 5 values each

1. MAX and MIN salary


2. COUNT employees per department
3. Average salary per department
4. Column Aliases
5. Expression in SELECT( add 10% bonus to salary)
• Create a table:

1. Employee(emp_id, first_name, last_name, job_id, doj, salary, dept_id, manager_id)


2. Departments(dept_id, dept_name, manager_id)
3. Customer(cust_id, first_name, last_name, address, city, phone, email)
4. Salgrade(grade, highsal, lowsal)

• Insert 5 values each

1. ORDER BY salary ascending and descending


2. ORDER BY with multiple columns
3. Set membership using IN
4. Set comparison using ALL or ANY
5. Test for empty relations using NOT EXISTS

• Create a table:

1. Employee(emp_id, first_name, last_name, job_id, doj, salary, dept_id, manager_id)


2. Departments(dept_id, dept_name, manager_id)
3. Customer(cust_id, first_name, last_name, address, city, phone, email)
4. Salgrade(grade, highsal, lowsal)

• Insert 5 values each

1. ANY ( atleast one should satisfy)


2. ALL(all must satisfy)
3. Subqueries in FROM clause
4. Total number of employees
5. Highest salary and lowest salary
• Create a table:

1. Employee(emp_id, first_name, last_name, job_id, doj, salary, dept_id, manager_id)


2. Departments(dept_id, dept_name, manager_id)
3. Customer(cust_id, first_name, last_name, address, city, phone, email)
4. Salgrade(grade, highsal, lowsal)

• Insert 5 values each

1. Average salary by department


2. Total salary per department
3. Count and sum aggregate functions
4. AVG and MAX aggregate functions
5. Using GROUP BY with aggregate

• Create a table:

1. Employee(emp_id, first_name, last_name, job_id, doj, salary, dept_id, manager_id)


2. Departments(dept_id, dept_name, manager_id)
3. Customer(cust_id, first_name, last_name, address, city, phone, email)
4. Salgrade(grade, highsal, lowsal)

• Insert 5 values each

1. Average salary by department


2. Total salary per department
3. UNION operators
4. UNION ALL operators
5. INTERSECT and EXCEPT
• Create a table:

1. Employee(emp_id, first_name, last_name, job_id, doj, salary, dept_id, manager_id)


2. Departments(dept_id, dept_name, manager_id)
3. Customer(cust_id, first_name, last_name, address, city, phone, email)
4. Salgrade(grade, highsal, lowsal)

• Insert 5 values each

1. Create a view
2. Use the view
3. Update a view
4. Drop a view
5. Join Two tables (employee with departments)

• Create a table:

1. Employee(emp_id, first_name, last_name, job_id, doj, salary, dept_id, manager_id)


2. Departments(dept_id, dept_name, manager_id)
3. Customer(cust_id, first_name, last_name, address, city, phone, email)
4. Salgrade(grade, highsal, lowsal)

• Insert 5 values each

1. Insert into a table using data from another table


2. UPDATE table using another table
3. DELETE using another table
4. Create a view
5. Use the view

You might also like