mysql簡單使用

//查看mysql版本
select version();
//查看日期
select date();
//查看時間
select time();
//添加主鍵
alter table ta add primary key(id);
//將文本中的數據導入MYSQL數據庫
load data local infile "E:/a.txt" into table tt;
//將數據導出到文本
select * from tt into outfile "E:/cc.txt";
//多表查詢
select tt.name,ta.pp,ta.yy from tt,ta where ta.id=tt.id and tt.name='aa';
//表裏面增加一列"sex"
alert table ta add column sex char(1);
//顯示服務器運行狀態
show status;
//創建索引
create index aa on tt(name);
//在另一個表中得到查詢條件
select * from score where event_id in (select event_id from event where type='T');
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章