Dsa Assigment
Dsa Assigment
Salary INT,
Datee DATE
);
Department_Name VARCHAR(25),
Location VARCHAR(20)
);
1. List all information of employee table
FROM Employee;
5. List the name, salary of the employees
FROM Employee;
6. List name and annual salary of all the employees
FROM Employee;
7.Write a query to display the Employe_name and yearly salary using alias “Yearly
Salary"
FROM Employee;
FROM Department;
FROM Employee;
10. Write a query to get all employee details from the employee table order by name,
descending
SELECT *
FROM Employee
salary
FROM Employee
FROM Employee;
13. Write a query to get all jobs from employee table in lower case
FROM Employee;
FROM Employee;
15. Write a query to get the first 2 characters of Employee_name from employee table
FROM Employee;
16. Write a query to get the first 3 characters of location from Department table
SELECT LEFT(Location, 3) AS First_Three_Characters
FROM Department;
18. Write a query to print the result of (121*22+44) and name the result set as Result
using as keyword
20. Write a SQL statement to create a simple table countries including columns
country_name VARCHAR(50),
region_id INT
);
21. Write a SQL statement to create a table named Location including columns loc_id,
Loc_title VARCHAR(50),
max_salary DECIMAL(10, 2)
);
22. Write a SQL statement to add column in the table countries to country_new_id
ADD ID INT;
26. Write a SQL statement to add a column region_id after state_province to the table
28. Delete Std_current_semester column from table(There is no table that have current semester data)
ALTER TABLE Students
35. Write a SQL statement to insert a record with your own value into the table countries
against each columns
36. Write a SQL statement to insert one row into the table countries against the column
countries table.
VALUES
FROM country_new;
41. Write a SQL statement to insert one row in jobs table to ensure that no duplicate value
job_title varchar(20),
min_salary decimal(10,2),
max_salary decimal(10,2)
);
2. Write a SQL statement to insert one row in jobs table to ensure that no duplicate value
Sure! I can assist you with the SQL statements needed to perform those operations.
44. Update your record in the Employees table to include some Notes.
values(1,'Hamdan Amir','Programmer',250000,'2024-05-16');
UPDATE employee
WHERE Employee_Number = 1;
45. Raise the unit price of all products in the Products table by 10% for all products that
ProductName VARCHAR(100),
UnitsInStock INT
);
UPDATE Products
WHERE UnitsInStock = 0;
SELECT * FROM Products;
46. Try to delete yourself from the Employees table. Could you?
WHERE Employee_Number = 1;
47. If you were not allowed to delete yourself from the Employees table, figure out what
WHERE Employee_Number = 1;
48. Insert yourself into the Employees table.
values(1,'Hamdan Amir','Programmer',250000,'2024-05-16');
CustomerID VARCHAR(50),
EmployeeID INT,
OrderDate DATE,
RequiredDate DATE
);
53. Include the following fields: OrderID, ProductID, UnitPrice, Quantity, Discount
OderID INT,
ProductID INT,
Quantity INT,
Discount DECIMAL(3, 2)
);
VALUES
(1, 21, 101, 50.00, 2, 0.10),