SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create table emp ( id int, name varchar(25), salary number ); insert into emp values(18,'Gala',25000); insert into emp values(17,'Sujal',20000); insert into emp values(65,'Yash',27000); insert into emp values(61,'Sahil',30000); insert into emp values(40,'Aayush',50000); insert into emp values(23,'Gori',60000); select * from emp; select name from emp; select id,name from emp; alter table emp add(city varchar(25)); update emp SET city='Mumbai'; select * from emp; update emp SET city='Ahmedabad' where id=18; update emp SET city='Surat' where id=61; select * from emp; create table emp1 as select * from emp; truncate table emp; select * from emp; ROLLBACK; select * from emp; COMMIT; select * from emp; drop table emp; select * from emp; select * from emp1; delete from emp1 where id=61; select * from emp1; create view empview1 as select id,name from emp1; select *from empview1; update emp1 SET city='' where id=23; select * from emp1; select *from empview1; create view empview2 as select id,name from emp1 where city IS NOT NULL; select *from empview2; create table stud ( rollno int, name varchar(25), class varchar(10), primary key(rollno) ); insert into stud values(1,'Vishal','FYIT'); insert into stud values(2,'Amit','FYDS'); insert into stud values(3,'Deva','FYIT'); insert into stud values(4,'Bhavesh','FYDS'); insert into stud values(5,'Abhay','FYIT'); insert into stud values(6,'Om','FYDS'); insert into stud values(7,'Nikhil','FYIT'); insert into stud values(8,'Shhubham','FYDS'); select *from stud; create table address ( rollno int, zipcode number, city varchar(25), foreign key (rollno) references stud(rollno) ); insert into address values(1,401209,'Mumbai'); insert into address values(2,423209,'Delhi'); insert into address values(3,469209,'Pune'); insert into address values(4,401789,'Jaipur'); insert into address values(8,401789,'Kolkata'); select *from address; select name,zipcode,city from stud inner join address on stud.rollno=address.rollno; select stud.rollno,name,city from stud left join address on stud.rollno=address.rollno; select stud.rollno,class,zipcode from stud right join address on stud.rollno=address.rollno; select stud.rollno,class,zipcode from stud cross join address; select name,zipcode,city,stud.rollno from stud,address;

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear