Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
practice sql_12AUG
--Sql Server 2014 Express Edition --Batches are separated by 'go' Create table Family( ID integer not null, name varchar(255) not null, City varchar(255) not null); Insert into Family(ID,name,City) Values(1,'iqbal','Sangli'), (2,'mumtaz','sangli'),(3,'kari','sangli'),(4,'kajal','sangli'); Insert into Family(ID,name,City) Values(5,'sankar','Chennai'); Select * from Family; Select distinct City from Family; Select name from Family where City='sangli'; Select name from Family where City='sangli' AND ID=2; Select name from Family where City='sangli' or City='Chennai'; Select name from Family Where City='Sangli' OR City='Chennai' Order by ID; Select name from Family Where City='Sangli' OR City='Chennai' Order by ID DESC; Alter table Family ADD Salary integer; Select * from Family; Update Family Set Salary=1000 where id=1; Select * from Family; Update Family Set Salary=10000 where City='Sangli'; Select * From Family; Select * from Family where Salary is not null; Insert into Family(ID,name,City,Salary) Values(6,'Manvitha','HYD',5000000),(7,'Sudha','Trichy',9000); Select * From Family; Alter table Family Add Age integer; Select Salary as fam_sal from Family; Select * from Family; Select * from family; Alter table Family Drop column ID; Select * from Family; Alter table Family Drop Column Salary; Select * from Family; Delete from Family where City = 'Trichy'; Select * from Family; create table Stud (ID integer not null, Name varchar(255), city varchar(255), C_nm varchar(255)); insert into Stud(ID, Name, city, C_nm) values (1,'Prathmesh','Mumbai','BCS2'),(2,'Riddhi','sangli','MCA2'),(3,'Saloni','sangli','BCS3'); select * from Stud; Alter table Stud Add Age integer; Select * from Stud; update Stud set Age=23; select * from Stud; Select Name,Age from Stud where exists (Select City From Stud where ID between 1 and 3);
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
create table employees as e. No, e. Name., e. Phone no, e. Salary
Sql Server's curse
index fragmentation and how to deal with it
MOVIE TIME
bdLojaRoupas
Student
Test1
Rank group by
sum vs count with multiple options in group by clause
samplequery
Please log in to post a comment.