2
 LBI - Microsoft  YSQL 1. T o se e th e datab ase: show databases; 2. T o create new data base : create database databasename; ex:- create database DB1; 3. T o us e th e datab ase: use databasename; ex:- use DB1; 4. T o del ete t he da tabase: Drop database databasename; Ex:- drop database db2; 5. T o cr eate a t able n use d data base : create table tablename!column name datat"pe#columnname1 datat"pe$; ex: create table %tudent!d nt#name &archar!1'$ $; (. To see the t able n)ormaton:  descrbe tablename or des tablename; descrbe %tudent; or des %tudent; *. T o see al l the tab le pr esen t n a data base :  show tables; +. ,nsert n t he &alues nto table:  nsert nto tablename/ &alues!&alue1#& alue2#&alue3$; 0ote:- The &alue should exact count wth the table column. ex:- nsert nto %tudent &alues!1'#sandp$; . 2 nd  s"ntax )or nsertn nto table: nsert n to tablen ame/ !columnname1#c olumnname2$ &alues!&alue1#&alue2$; Ex:- nsert n to %tudent !d#name$ &al ues!11#a"atr $; 1'.ultple records at a tme: nsert nto tablename/ &alues!&al1#&al2$#!&al3#&al4$; Ex:- nsert nto %tudent &alues!12#andhe $#!13#sma$ ; 11.%ee the table n)ormaton:  select 6 )rom tablemname Ex:- select 6 )rom %tudent; 12.update the table n)ormaton: update tablename/ setcolumnname/7&alue/#columnname/7&alue/ where columnname/7&alue/; ex:- update %tudent set d712#name78urusmta; 13.Delete n the table!Delete some n)ormaton )r om table$ delete )rom tablename/ where condton/ delete )rom %tudent where d713; LBI - Microsoft

Mysql

Embed Size (px)

DESCRIPTION

sql query

Citation preview

LBI - Microsoft

LBI - Microsoft

LBI - Microsoft

MYSQL1. 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 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 (columnname1,columnname2) values(value1,value2);Ex:- insert into Student (id,name) values(11,Gayatri);10. Multiple records at a time:insert into values(val1,val2),(val3,val4);Ex:- insert into Student values(12,Kandhei),(13,sima);11. See the table information: select * from tablemnameEx:- select * from Student;12. update the table information:update set=,= where =;ex:- update Student set id=12,name=Aurusmita;13. Delete in the table(Delete some information from table)delete from where delete from Student where id=13;

LBI - Microsoft

LBI - Microsoft

LBI - Microsoft