DBMS Query

          (1)  CREATE TABLES
     INSERT VALUES IN ALL 5 TABLES

Query:-  
CREATE TABLE CofRajkot_detail(

Name varchar(50),
Age int,
PartyName varchar(50),
SLocation varchar(50),
)
insert into dbo.CofRajkot_detail(Name,[Age],PartyName,SLocation)
values('Denish Akbari',25,'BJP','Rajkot');
insert into dbo.CofRajkot_detail(Name,[Age],PartyName,SLocation)
values('Bansal Vaishnav',27,'Congress','Rajkot');
insert into dbo.CofRajkot_detail(Name,[Age],PartyName,SLocation)
values('Siddharth Dhameliya',24,'AAP','Rajkot');
insert into dbo.CofRajkot_detail(Name,[Age],PartyName,SLocation)
values('Kaushal Doshi',30,'SAPA','Rajkot');
insert into dbo.CofRajkot_detail(Name,[Age],PartyName,SLocation)
values('Nipun Parekh',32,'other','Rajkot');


(2)  WRITE ONE QUERY FOR PRIMARY KEY
       WRITE TWO QUERIES FOR ALTER, ONE WITH         ADD  AND ONE WITH ALTER
QUERY:- 
alter table CofRajkot_detail
add primary key(Name)

alter table CofRajkot_detail
alter column Name varchar(50) NOT NULL

(3) DROP ANY ONE TABLE
Query:-
drop table CofRajkot_detail

(4) TRUNCATE ANY ONE TABLE
QUERY:-
truncate table CofMorbi_detail

(5) DELETE 2 ROWS FROM ALL FIVE TABLES
QUERY:-
delete CofRajkot_detail
where Name='Bansal Vaishnav' or Name='Kaushal Doshi';

(6) ADD THAT COLUMN
Query:-
                      ALTER TABLE CofMorbi_detail
                      ADD Age int;
                      update CofMorbi_detail
              set Age=24
              where Name='Marlin Shah'

(7) WRITE DOWN QUERY FOR UPDATE YOUR COLUMN VALUES
Query:-
                 update CofMorbi_detail
                       set Age=22
                 where Name='Marlin Shah'
                  select * from CofMorbi_detail

(8) DELETE TWO COLUMNS
Query:-
                  ALTER TABLE CofMorbi_detail
                  DROP COLUMN Age;
                  select * from CofMorbi_detail 


Comments

Popular posts from this blog

Sudoku solving using CV and AI with an Image of Sudoku as Input!

I AM PATHO

We'll Make AatmanirbharBharat!