• <sub id="h4knl"><ol id="h4knl"></ol></sub>
    <sup id="h4knl"></sup>
      <sub id="h4knl"></sub>

      <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
      1. <strong id="h4knl"></strong>

      2. 經(jīng)典SQL語句

        時(shí)間:2024-06-17 18:44:44 SQL 我要投稿

        經(jīng)典SQL語句大全

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

          如:create database student;

          2、連接到一個(gè)已經(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 var20) not null)

          5、刪除表: 表名

          如: stuInfo;

          6、修改表:alter table

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

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

          如:alter table stuInfo add stuGender var10)

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

          如:alter table stuInfo modify stuGender int

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

          如:alter table stuInfo change stuName stuAddress var30)

          刪除列:alter table 表名 drop 列名

          如: alter table stuInfo drop stuGender

          7、將創(chuàng)建的表的語句反向?qū)С觯?show create table 表名

          8、查詢表的所有內(nèi)容:select * from 表名

          查詢表的部分內(nèi)容: select 列名列表 from 表名

          9、查詢表結(jié)構(gòu):show columns from 表名

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

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

           into 表名 (列名列表) select

          如將stuInfo表中的所有的學(xué)生姓名復(fù)制到students表中的stuName列中: into students(stuName) select stuName from stuInfo

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

          如刪除stuID為4的人的數(shù)據(jù): from stuInfo where stuId=4

        《&.doc》
        将本文的Word文档下载到电脑,方便收藏和打印
        推荐度:
        点击下载文档

        【經(jīng)典SQL語句】相關(guān)文章:

        oracle的sql語句01-21

        SQL查詢語句大全10-24

        SQL語句的理解原則10-05

        mysql SQL語句積累參考10-02

        sql語句的各種模糊查詢08-25

        Oracle的sql語句模擬試題及答案10-12

        SQL語句中的正則表達(dá)示07-28

        SQL優(yōu)化大全09-09

        2016最新J2EE中SQL語句自動構(gòu)造方法08-02

        PHP防止SQL注入的例子09-25

        在线咨询
        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码
      3. <sub id="h4knl"><ol id="h4knl"></ol></sub>
        <sup id="h4knl"></sup>
          <sub id="h4knl"></sub>

          <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
          1. <strong id="h4knl"></strong>

          2. 一区二区日韩动漫AV | 亚洲福利站免费 | 中文字幕日韩精品欧美一区久久 | 中文字幕精品一区二区精品 | 日本欧美亚洲精品在线观看 | 亚洲成色在线播放 |

            經(jīng)典SQL語句大全

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

              如:create database student;

              2、連接到一個(gè)已經(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 var20) not null)

              5、刪除表: 表名

              如: stuInfo;

              6、修改表:alter table

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

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

              如:alter table stuInfo add stuGender var10)

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

              如:alter table stuInfo modify stuGender int

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

              如:alter table stuInfo change stuName stuAddress var30)

              刪除列:alter table 表名 drop 列名

              如: alter table stuInfo drop stuGender

              7、將創(chuàng)建的表的語句反向?qū)С觯?show create table 表名

              8、查詢表的所有內(nèi)容:select * from 表名

              查詢表的部分內(nèi)容: select 列名列表 from 表名

              9、查詢表結(jié)構(gòu):show columns from 表名

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

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

               into 表名 (列名列表) select

              如將stuInfo表中的所有的學(xué)生姓名復(fù)制到students表中的stuName列中: into students(stuName) select stuName from stuInfo

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

              如刪除stuID為4的人的數(shù)據(jù): from stuInfo where stuId=4