Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
2 views1 page

SQL

The document outlines a series of SQL commands for database management, including creating databases and tables, inserting data, and performing various queries. It covers operations such as selecting, updating, deleting, and joining tables, as well as filtering and sorting data. Additionally, it includes commands for managing table structures and data integrity, such as truncating and dropping tables.

Uploaded by

Arshad Mohd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

SQL

The document outlines a series of SQL commands for database management, including creating databases and tables, inserting data, and performing various queries. It covers operations such as selecting, updating, deleting, and joining tables, as well as filtering and sorting data. Additionally, it includes commands for managing table structures and data integrity, such as truncating and dropping tables.

Uploaded by

Arshad Mohd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

SQL

1-show databases;
2-create database sample;
3-use sample;
4- create table student(id int,name text,mark int,age int);
5- show tables;
6-insert into student values(1,"john",50,20);
7-describe fruits;
8-select * from student;(to print all data)
9- create table employe(id int primary key, name text, dept text, salary int);
10-insert into employe(id,name) values(2,'Athira');
11-insert into employe values(3,"mal","developer",20000),
(4,"ali","developer",30000);

12-create table new_employe as select * from employe;


13- create table developer as select * from employe;
14-create table salary1 as select * from employe where salary>=20000;create table
salary1 as select * from employe where salary>=20000;
15-create table depar as select from employe where dept='develop' OR dept='hr'; (or
create table depar as select from employe where deptin ('develop','hr')
16-drop table tablename;
17-select distinct name from student;
18-select name,age from student where mark>=40;(where close),select * from student
where name='sunny';
select * from student where age>20 and mark>=40;
19-select * from student where name like 'a%';(starting starts from a)
select * from student where name like '%a';(ends with a)
20-select * from student where name like '__s___';(aaavishalla letter ulla name
print cheyya)
21-select * from student order by mark;(in asending)
select * from student order by mark desc;
22- select * from student where mark>=40 and mark<=50;
23-select * from student where mark between 40 and 50;
24-select * from student limit 5;(from where to print)
25-update student set mark=49 where name='jhon';
update student set mark=49 where id=1;(aavishalla jhon maathram)
26- update student set mark=49,age=49 where name='sera';(multiple columns)
27-delete from student id=1;(single row delete cheyyan)
28- truncate student;(to clear all table data)
29-drop table student(motham table kalayaan)
30-SELECT * FROM Table ORDER BY ID DESC LIMIT
31-select count(distinct year) from movies;
32-select name,genre from movies left outer join movies_genres on
movies.id=movie_id limit 10;
33-select * from emp join empid on id=emp_id join dep on
empid.dept_name=dep.dept_name;(3 joining)
34-select * from roles join actors on roles.actor_id=actors.id join movies on
roles.movie_id=movies.id limit 5;
35-select sum(salary) from company;(total value kaaanan)

You might also like