0% found this document useful (0 votes)
2 views

SQL Assignment-overview of Ai

The document contains SQL queries for creating and managing an Employees table with constraints, including inserting records, modifying salaries, and updating departments. It also includes queries for calculating product values, finding the highest-priced product, and retrieving employee information based on age and location. Additionally, it covers updating salaries and deleting employee records.

Uploaded by

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

SQL Assignment-overview of Ai

The document contains SQL queries for creating and managing an Employees table with constraints, including inserting records, modifying salaries, and updating departments. It also includes queries for calculating product values, finding the highest-priced product, and retrieving employee information based on age and location. Additionally, it covers updating salaries and deleting employee records.

Uploaded by

tawop20127
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Q-1 Write an SQL query to create a table named Employees with the following columns: EmployeeID

(as the Primary Key), FirstName, LastName, DepartmentID (as a Foreign Key), and Salary. Ensure that
EmployeeID is unique and that DepartmentID references a valid entry in the Departments table.

Q-2 Using SQL, complete the following tasks:

 Create the Employees table with the necessary constraints.

 Insert a minimum of four records into the Employees table.

 Modify the salary of the employee with EmployeeID 101 to 70,000.

 Update the department of employees based on their JobTitle, assuming that those with the
title 'Sales Manager' belong to the Sales department.

Q-3

Product Quantity Price

Smartwatch 15 900

Smartphone 30 100

Neckband 5 80

DSLR 8 200
camera

Write an SQL query to calculate the total value (Quantity × Price) of each product.

Write an SQL query to find the product with the highest price.

Q-4

EmployeeID Name Location Salary Age

101 Alice Johnson New York 68000 29

102 Mark Spencer Los Angeles 72000 34

103 Priya Shah Chicago 65000 27

104 Daniel Kim Houston 70000 31

San
105 Fatima Noor 75000 30
Francisco

a.
Write an SQL query to retrieve the names and salaries of employees who are older than 30.
b.
Write an SQL query to update the salary of the employee with EmployeeID 103 to 70,000.

c.
Write an SQL query to find the average salary of all employees located in 'New York' or 'Los Angeles'.

d.
Write an SQL query to delete the record of the employee named 'Daniel Kim'.

You might also like