SQL--Simple Sentence Learning Summary 7 article

Source: Internet
Author: User

/**1.create Table guestbook**/

--if object_id (' guestbook ') is null

--create TABLE Guestbook (id int PRIMARY KEY, visitor VARCHAR (+), comments text,entrydate DATETIME)


/**2.insert Data into table guestbook**/

--insert into guestbook values (3, ' a ', ' 123 ', ' 2016-05-12 ')

--insert into guestbook values (4, ' a ', ' 1234 ', ' 2016-05-12 ')

--insert into guestbook values (5, ' a ', ' 12345 ', ' 2016-05-12 ')


/**3.drop Table guestbook**/

--if object_id (' guestbook ') is not null

--drop Table Guestbook

--IF exists (SELECT * from sysobjects where name= ' guestbook ')

--drop Table Guestbook


/**4.update Table guestbook**/

--update Guestbook Set visitor= ' B ' where id= ' 4 '


/**5.select All record**/

--select * FROM Guestbook


/**6.delete data (one record) from table guestbook**/

--delete Guestbook where id= ' 3 '


/**7.truncate Table Guestbook (delete all datas from table Guestbook) **/

--truncate Table Guestbook

This article comes from the "Ricky's blog" blog, please be sure to keep this source http://57388.blog.51cto.com/47388/1772705

SQL--Simple Sentence Learning Summary 7 article

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.