Mysql常用SQL語句

2021-10-04 07:04:51 字數 605 閱讀 6547

登入mysql資料庫:mysql -uroot –p

顯示所有的資料庫:show databases;

建立資料庫:create database 《資料庫名》

刪除資料庫:drop database 《資料庫名》

開啟資料庫:create database 《資料庫名》

建立資料庫表:create table 《表名》 ( 《欄位名1> 《型別1> [,..《欄位名n> 《型別n>]);

檢視資料庫表結構:desc 《表名》;

在表中插入記錄:insert into 《表名》 [( 《欄位名1>[,..《欄位名n > ])] values (值1 )[, (值n )];

查詢表中的記錄:select 《欄位1,欄位2,...> from 《表名》 where 《表示式》;

刪除資料庫表:drop table 《表名》;

MySql 常用SQL語句

create database kali use kali show tables create table students sno varchar 10 primary key,sname varchar 10 not null,varchar 2 check in 男 女 age varcha...

常用sql語句(mysql)

給表新增列 sql alter table table name add column col name varchar 255 not null default default value 增加表列,指定格式 sql alter table table name add col name bool...

MySQL常用SQL語句

查詢一張表中的所有資料 sql view plain copy select from table name 查詢一張表中的指定列資料 sql view plain copy select column a,column b from table name 按條件查詢一張表中的所有資料 sql vi...