The document outlines a series of SQL commands for managing a database named 'company', including creating and modifying tables, inserting and selecting data, and performing updates and deletions. It also includes commands for managing another database called 'project' and demonstrates various SQL operations such as altering table structures and dropping databases. The document concludes with the removal of both databases.
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
5 views
my script
The document outlines a series of SQL commands for managing a database named 'company', including creating and modifying tables, inserting and selecting data, and performing updates and deletions. It also includes commands for managing another database called 'project' and demonstrates various SQL operations such as altering table structures and dropping databases. The document concludes with the removal of both databases.
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2
show databases;
create database company;
use company; Create table employees1( ID int primary key, FirstName varchar(100), SecondName varchar(100), Age varchar(150), Area varchar(150)); Desc employees1; Alter table employees1 Add column Email varchar(150); Desc employees1; Alter table employees1 Drop Column SecondName; Desc employees1; Alter table employees1 modify column age int; Alter table employees1 Rename column FirstName to FullName; Alter table employees1 Change column ID RollID int; Desc employees1; Insert into employees1 values(1, 'Naveenpandiyan', 21, 'Velachery', '[email protected]'); Insert into employees1 values(2, 'Meenakshi', 21, 'ECR', '[email protected]'),(3, 'Mahalakshmi', 22, 'Velachery', '[email protected]'); Insert into employees1 values(4, 'ChitraDevi', 42, 'Ramanathapuram', '[email protected]'),(5, 'Sabitha', 23, 'Navalur', '[email protected]'); Select * from employees1; Select RollID from employees1; Select FullName, Area from employees1; Select * from employees1; Select Distinct Area from employees1; Select * from employees1 where age > 21; Select * from employees1 where age<>22; Select * from employees1; Select FullName,Age, case When Age > 21 Then 'Employee with Experience.Eligible for Sr.Post' When Age = 21 Then 'Employee with Mid-experience (or) Fresher.Eligible' end as eligibility from employees1; Select * from employees1; Delete from employees1 where RollID=3; Select * from Employees1; show databases; use company; drop database students; Create table employees2( ID int primary key, FullName varchar(150), Age int, Area varchar(150), Email varchar(150), country varchar(150)); Alter table employees2 Drop column country; Alter table employees2 rename column email to MailID; Desc employees2; Drop table employees2; Truncate table employees1; Desc employees1; Drop table employees1; Drop database company; show databases; use project; show tables; Select * from list1; Delete from list1 Where ID=5; Select * from list1; use company; Select * from employees1; update Employees1 set Area='Velachery' Where RollID = 4; update employees1 Set age = 44 Where RollID = 4; use project; select * from list1; update list1 set Department = 'School of computer Science' Where ID = 2; drop database company; drop database project;