SQL Basics 2

Source: Internet
Author: User

Create DATABASE Fuxi--Creating a db named "Fuxi"
Go--Connection statement
Use Fuxi--using a database named "Fuxi"
Go
Create table Hua--Creating tables named "Hua"
(
--Adding columns to a table
Gonghao int,
Mingzi varchar (10),
Gongzi int,
Bumen varchar (10),
nianling int,
)
Go
--Inserting data
Insert into Hua values (1, ' Zhang San ', 2600, ' sales department ', 26)
Insert into Hua values (2, ' Stone ', 3600, ' aftermarket ', 21)
Insert into Hua values (3, ' penalty ', 6000, ' admin ', 33)
Insert into Hua values (4, ' Thunder ', 3800, ' repair Department ', 26)
Go
--Querying data
Select *from Hua
Select Gongzi,mingzi from Hua
Select Bumen,gongzi from Hua where mingzi= ' thunder '
Select *from hua where Gongzi between 3800 and 6000
--Modify data
Update Hua Set gonghao=1
Update Hua set mingzi= ' Thunder ' where gonghao=4
Update Hua set bumen= ' repair Department ' where Gongzi between 2600 and 3600
Alter table hua add en int
--Delete data
ALTER TABLE Hua drop column en
Delete from Hua where mingzi= ' thunder '
Delete from Hua
drop table Hua
Drop Database Fuxi

SQL Basics 2

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.