午夜国产狂喷潮在线观看|国产AⅤ精品一区二区久久|中文字幕AV中文字幕|国产看片高清在线

    sql語句大全
    來源:易賢網(wǎng) 閱讀:1387 次 日期:2015-08-12 15:02:39
    溫馨提示:易賢網(wǎng)小編為您整理了“sql語句大全”,方便廣大網(wǎng)友查閱!

    1、創(chuàng)建數(shù)據(jù)庫: create database <數(shù)據(jù)庫名>;

    如:create database student;

    2、連接到一個已經(jīng)存在的數(shù)據(jù)庫: use <數(shù)據(jù)庫名>;

    如:use student;

    3、刪除數(shù)據(jù)庫:drop database <數(shù)據(jù)庫名>;

    如: drop database student;

    4、創(chuàng)建表:create table <表名>(<列名><列的數(shù)據(jù)類型>[<列的約束>])

    如:create table stuinfo(stuid int primary key,stuname varchar(20) not null)

    5、刪除表: drop table <表名>

    如: drop table stuinfo;

    6、修改表:alter table

    給表添加新列: alter table <表名> add <列名><列的數(shù)據(jù)類型>;

    添加多列,中間用逗號隔開

    如:alter table stuinfo add stugender varchar(10)

    修改某列的數(shù)據(jù)類型:alter table <表名> modify <列名><新數(shù)據(jù)類型>

    如:alter table stuinfo modify stugender int

    修改列名:alter table <表名> change <老列名><新列名><數(shù)據(jù)類型>

    如:alter table stuinfo change stuname stuaddress varchar(30)

    刪除列:alter table <表名> drop <列名>

    如: alter table stuinfo drop stugender

    7、將創(chuàng)建的表的語句反向導出: show create table <表名>

    8、查詢表的所有內容:select * from <表名>

    查詢表的部分內容: select <列名列表> from <表名>

    9、查詢表結構:show columns from <表名>

    10、插入單行數(shù)據(jù):insert into <表名>(<列名列表>) values(<值列表>)

    11、插入多行數(shù)據(jù):作用相當于將數(shù)據(jù)從一個表復制到另一個表

    insert into <表名> (列名列表) select

    如將stuinfo表中的所有的學生姓名復制到students表中的stuname列中:insert into students(stuname) select stuname from stuinfo

    12、刪除數(shù)據(jù):delete from <表名> where<過濾條件>

    如刪除stuid為4的人的數(shù)據(jù):delete from stuinfo where stuid=4

    更多信息請查看IT技術專欄

    更多信息請查看數(shù)據(jù)庫
    易賢網(wǎng)手機網(wǎng)站地址:sql語句大全

    2025國考·省考課程試聽報名

    • 報班類型
    • 姓名
    • 手機號
    • 驗證碼
    關于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
    工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務許可證:(云)人服證字(2023)第0102001523號
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關注公眾號:hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權所有:易賢網(wǎng)