MySQL database table data Insert, modify, delete operation and instance application

Source: Internet
Author: User

Data insert, modify, delete operations for 1.MySQL database tables SQL syntax format:

1 CREATE DATABASEdb0504;2 3  Usedb0504;4 5 CREATE TABLEStudent (6SnoVARCHAR(Ten) not NULL UNIQUE PRIMARY KEY,7SnameVARCHAR( -) not NULL,8Ssex enum ('male','female') not NULL DEFAULT 'male',9 Sbirth Date,TenSclassVARCHAR(Ten), OneZnoCHAR(4) A)DEFAULTCharSet=gb2312; - #添加操作 - INSERT  intoStudent the VALUES('2012010713','Ding warm','female','1993-9-9','Internet of Things 12-1','z002'); -  - INSERT  intoStudent (Sno,sname,ssex,sbirth,sclass,zno) - VALUES('2011010503','Kong Chao','male','1993-9-19','Automation 11-1','z006'); +  - INSERT  intostudent (Sno, sname, Ssex, ZnO) + VALUES('2011010521','Han Mei','female','z006'); A  at INSERT  intostudent (sname, ZnO, Sno) - VALUES('Han Mei 2','z006','2011010522'); -  - INSERT  intoStudentVALUES -('2011010501','Kong Chao 1','male','1993-9-19','Automation 11-1','z006'); -('2011010505','Kong Chao 2','male','1993-9-19','Automation 11-1','z006'); in('2011010504','Kong Chao 3','male','1993-9-19','Automation 11-1','z006'); -('2011010505','Kong Chao 4','male','1993-9-19','Automation 11-1','z006'); to #修改操作 + UPDATEStudent - SETSname= 'Zhang San', Sbirth= '1993-6-19' the WHERESname= 'Ding warm'; *  $ UPDATEStudentSETZno=  Left(ZnO,3);Panax Notoginseng #删除操作 - Delete  fromStudent the whereSname='Zhang San'; +  A #清空表操作 the truncatestudent; #高效 + Delete  fromstudent; -  $ SELECT *  fromStudent

Inserting: Insert

Modified: Update

Remove: Delete

2. Example development

MySQL database table data Insert, modify, delete operation and instance application

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.