MY SQL
1)
(a) Write a Query to Create a new database in the name of "12A2025"
(b) Write a Query to Open the database "12A2025"
(c) Write a Query to create the above table called: student
(d) Write a Query to list all the existing database names.
1
MY SQL
(e) Write a Query to List all the tables that exists in the current database.
(f) Write a Query to insert all the rows of above table into student table.
(g) Write a Query to display all the details of the Employees from the above table.
(h) Add a new column as area with size 20 characters
(i) Add primary key to the attribute Rollno.
2
MY SQL
(j) Rename the attribute DOA to DOB
(k) Remove the attribute area from the table
(l) Remove the primary key from the table
(m) Move the attribute DOB and keep after name
2)
a. Write a Query to select distinct Department from STU table.
3
MY SQL
b. To show all information about students of History department
c. Write a Query to list name of female students in Hindi Department
d. Write a Query to list name of the students whose ages are between 18 to 20
e. Write a Query to display the name of the students whose name is starting with 'A'
4
MY SQL
f. Write a query to list the names of those students whose name have second alphabet 'n' in their
names.
g. Display the name and age of the student from Computer and History department
h. Display the details of the students who doesn’t have a department name
i. Write a query to display department wise students names in alphabetical order.
5
MY SQL
3)
a. Write a Query to delete the details of Roll number is 8.
b. Write a Query to change the fess of Student to 170 whose Roll number is 1, if
the existing fess is less than 130.
c. Write a Query to add a new column Area of type varchar in table STU.
d. Write a Query to Display Name of all students whose Area Contains NULL.
e. Write a Query to delete Area Column from the table STU.
6
MY SQL
f. Write a Query to delete table from Database.
4)
a. Display the no of staff in each department.
b. Display the average salary paid in each department.
7
MY SQL
c. Display the name of the department which has no of staff more than 2.
d. Display the total salary paid gender wise.
e. Display the minimum and maximum salary paid for each department.
f. Display the name of the staff who is getting maximum salary.
g. Display the details of the staff who are getting more than average salary.
8
MY SQL
5)
a. To display the total Unit price of all the products whose Dcode as 102.
b. To display details of all products in the stock table in descending order of Stock date.
c. To display maximum unit price of products for each dealer individually as per dcode from the table
Stock.
9
MY SQL
d. To display the Pname and Dname from table stock and dealers.
e. To display the total quantity Dname from the table stock and dealers
10
MY SQL
6)
a. To display employee ids, names of employees, job ids with corresponding job titles.
b. To display names of employees, sales and corresponding job titles who have achieved sales more
than 1300000.
c. To display names and corresponding job titles of those employees who have 'SINGH' (anywhere) in
their names.
11
MY SQL
d. Display the natural join and equi join of these tables.
e. Perform cartesian product on these tables.
12