You are on page 1of 2

LBI - Microsoft

MYSQL
1. To see the database:
show databases;
2. To create new database:
create database databasename;
ex:- create database DB1;
3. To use the database:
use databasename;
ex:- use DB1;
4. To delete the database:
Drop database databasename;
Ex:- drop database db2;
5. To create a table in used database:
create table tablename(columnname datatype,columnname1
datatype);
ex: create table Student(id int,name varchar(10));
6. To see the table information:
describe tablename
or des tablename;
describe Student;
or des Student;
7. To see all the table present in a database:
show tables;
8. Inserting the values into table:
insert into <tablename> values(value1,value2,value3);
Note:- The value should exact count with the table column.
ex:- insert into Student values(10,sandip);
9. 2nd syntax for inserting into table:
insert into <tablename> (columnname1,columnname2)
values(value1,value2);
Ex:- insert into Student (id,name) values(11,Gayatri);
10.Multiple records at a time:
insert into <tablename> values(val1,val2),(val3,val4);
Ex:- insert into Student values(12,Kandhei),(13,sima);
11.See the table information:
select * from tablemname
Ex:- select * from Student;
12.update the table information:
update <tablename>
set<columnname>=<value>,<columnname>=<value> where
<columnname>=<value>;
ex:- update Student set id=12,name=Aurusmita;
13.Delete in the table(Delete some information from table)
delete from <tablename> where <condition>
delete from Student where id=13;

LBI - Microsoft

LBI - Microsoft

LBI - Microsoft

You might also like