mysql表操作

來源:互聯網
上載者:User

標籤:null   int   comm   birt   atime   select   hda   utf8   修改表   

說明:student是要建立的表名

主鍵:primary key

注釋:comment

1,建立表:

create table student(

sno varchar(20) not null primary key comment ‘學號‘,

sname varchar(20) not null comment ‘學生姓名‘,

ssex varchar(20) not null comment ‘性別‘,

sbirthday datatime comment ‘出生年月‘

)charset=utf8 collate=utf8_general_ci;

2,添加表資訊:

insert into student values

   (108,‘曾華‘,‘男‘,‘1977-09-01‘,95033),
   (105,‘匡明‘,‘男‘,‘1975-10-02‘,95031),
   (107,‘王麗‘,‘女‘,‘1976-01-23‘,95033),
   (101,‘李軍‘,‘男‘,‘1976-02-20‘,95033),
   (109,‘王芳‘,‘女‘,‘1975-02-10‘,95031),
   (103,‘陸君‘,‘男‘,‘1974-06-03‘, 95031);

3,刪除整個表

drop table student;

4,查看錶所有內容

select * from student;

5,查看錶某個欄位內容 son或sname或ssex或sbirthday

select sno from student;

6,查看多個欄位內容

select sno,sname from student;

7,修改表內容

update student set sno=‘200‘ where sno=‘101‘;

mysql表操作

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.