It Project For Class 12 1
It Project For Class 12 1
SQL
QUERIES
1. Write down syntax and mysql program to create a database STUDENT and its
OUTPUT.
AIM
To write a MYSQL code to create a database STUDENT listing out its SYNTAX, and
its OUTPUT.
SYNTAX
PROGRAM
OUTPUT
2.Write down syntax and mysql program to delete a database STUDENT and its
OUTPUT.
AIM
To write a MYSQL code to delete a database STUDENT listing out its SYNTAX, and
its OUTPUT.
SYNTAX
PROGRAM
OUTPUT
3.Write down a mysql program to create a table TEACHER with the following field
names given below and its OUTPUT.
⚫ Teacher_ID,
⚫ First_Name,
⚫ Last_Name,
⚫ Gender,
⚫ Salary,
⚫ Date_of_Birth,
⚫ Dept_No
AIM
To write a mysql code to create a table TEACHER with the given field names
⚫ Teacher_ID,
⚫ First_Name,
⚫ Last_Name,
⚫ Gender,
⚫ Salary,
⚫ Date_of_Birth,
⚫ Dept_No
PROGRAM
OUTPUT
4. Write down mysql program to show the databases and tables created?
AIM
To write a mysql command to show the databases and tables and its output.
PROGRAM
mysql> show databases;
OUTPUT
PROGRAM
mysql> show tables;
OUTPUT
AIM
To write a mysql program to list out the field name Teacher_ID, First_Name,
Last_Name, Gender, Salary, Date_of_Birth, Dept_No
along with its field type and constraints for the table TEACHER in the database
STUDENT
PROGRAM
mysql > use student;
Database changed
OUTPUT
Write down mysql program to set a default value for the field SALARY as
6.
30000 to the table name TEACHER whose field names are listed below
⚫ Teacher_ID,
⚫ First_Name,
⚫ Last_Name,
⚫ Gender,
⚫ Salary,
⚫ Date_of_Birth,
⚫ Dept_No
AIM
To write a mysql command to set a default value for the field SALARY as
30000 in table TEACHER.
PROGRAM
mysql > ALTER TABLE TEACHER ALTER SALARY SET DEFAULT 30000;
OUTPUT
7.Write a mysql command to INSERT VALUES INTO table TEACHER in its field
Teacher_ID, First_Name, Last_Name, Gender, Salary, Date_of_Birth, Dept_No
AIM
To write a mysql command to INSERT VALUES INTO table TEACHER in its field
Teacher_ID, First_Name, Last_Name, Gender, Salary, Date_of_Birth, Dept_No
PROGRAM
OUTPUT
⚫ Teacher_ID,
⚫ First_Name,
⚫ Last_Name,
⚫ Gender,
⚫ Salary,
⚫ Date_of_Birth,
⚫ Dept_No
AIM
⚫ Teacher_ID,
⚫ First_Name,
⚫ Last_Name,
⚫ Gender,
⚫ Salary,
⚫ Date_of_Birth,
⚫ Dept_No
PROGRAM
OUTPUT
AIM
PROGRAM
OUTPUT
10
10. Write a mysql command to find the following using AGGREGATE FUNCTIONS
in Table Teacher. The field names in Teacher table is listed below.
Teacher_ID, First_Name, Last_Name, Gender, Salary, Date_of_Birth, Dept_No
(i) Calculate the sum of salary given to the Teachers and name it as Total_Salary.
(ii) Calculate the maximum and minimum salary of the Teacher and name it as
Max_Salary and Min_Salary.
(iii) Calculate the total number of Teachers whose salary is >40000.
AIM
PROGRAM
mysql > SELECT SUM(Salary) AS Total_Salary FROM Teacher;
OUTPUT
PROGRAM
mysql > SELECT MAX(Salary) AS Max_Salary, MIN(Salary) AS Min_Salary
FROM Teacher;
OUTPUT
PROGRAM
mysql > SELECT COUNT(Salary) FROM Teacher WHERE Salary > 40000;
OUTPUT
12