天天看點

mysql資料庫簡單操作

1、顯示所有資料庫:show databases

2、檢視所有使用者:select  host,user,password from mysql.user;

3、建立資料庫:create database sybdb;

4、使用資料庫:use  sybdb ;

5、顯示資料庫中的表: show tables;

6、建立表:create table tb_userinfo(id int primary key auto_increment,uname varchar(

20),gender varchar(2),birthday date,telephone varchar(11));

7、顯示表結構:desc tb_userinfo;|describe tb_userinfo;

8、插入記錄:insert into tb_userinfo(uname,gender,birthday,telephone) values('syb','m'

,now(),'13100000000'),('wy','n','1980-1-1','13711111111');   

9、最簡單的查詢語句:select * from tb_userinfo;

10、修改記錄:update tb_userinfo set address='shandongsheng' where uname='syb';

11、删除記錄:delete from tb_userinfo where id in(3,4);

12、删除字段:alter table tb_userinfo drop address;

13、删除表:drop table tb_userinfo;

14、删除資料庫:drop database sybdb;

繼續閱讀