SQL的一些語句,可能有用!
阿新 • • 發佈:2019-01-04
-
select count(*) from tablename; --輸出表格總行數
-
select * from tablename limit rowLimiter,numRows; --輸出表格rowLimiter之後的numRows行(numRows可超出總行數)
-
describe tablename; --顯示錶格資料型別資訊
-
show tables; --顯示當前資料庫下所有的表格名稱
-
load data local infile 'D:/myFolder/myfile.txt' into table tablename; --將本地txt文件資料匯入指定表格,同一行的資料用\t分隔
-
delete from tablename; --刪除表格記憶體儲的資料,但保留表格的基本資訊
-
drop table tablename; --刪除表格及表格記憶體儲的資料
-
create table tablename( id int not null, name varchar(40) not null, city varchar(20), salary int); --建立表格並指定資料型別
-
create database dbname; --建立資料庫
-
show databases; --顯示所有的資料庫名稱
-
use dbname; --在指定資料庫下操作
-
load data local infile 'D:/myFolder/myfile.txt' into table tablename fields terminated by ',' lines terminated by '\n'; --以指定分隔符方式匯入本地文字資料