Creation of tables for SQL Server databases with manipulation of data tables using T-SQL statements

Source: Internet
Author: User
Tags ming

Creation of tables and use of T-SQL statements
一,表的创建与基本概念                                        表是包含数据库中所有数据的数据库对象,表定义是一个集合。数据在表中组织方式与在电子表格中相似,都是按行和列的格式组织的。每一行代表一条唯一的记录,每一列代表记录中的一个字段。**SQLserver 中的表包含下列主要组件                **                  #列: 每一列代表由表的建模的对象的某个属性,列如,一个产品表有id 列,颜色列和重量列                    #行: 每一行代表由表建模的对象的一个单独的实例

Data Type

Creation of tables

Manipulating data tables with T-SQL statements


1, query Wang Ming's results? Result: Wang Ming 90
Select name, score from student-1 name = ' Wang Ming '

2, to Wang Ming plus 2 points?
Update Student-1 Set score = score +2 WHERE name = ' Wang Ming '

3, the query is not empty students?
Select from student-1 where memo is not NULL

4. Students who have more than 95 points in the query?
Select
from student-1 where score >95


5, Wang Ming transfer, Wang Ming deleted?
Delete from student-1 where name = ' Wang Ming '


6, came a new classmate, named Wang Guonan?
INSERT INTO Student-1
VALUES (20, ' Wang Guonan ', ' 111111111111 ', ' 3 ', ' 95 ', ' running ')

7. Query average score?
Select AVG (score) as average score
From Student-1

8. Query the surname Zhang?
SELECT * FROM Student-1
Where name like ' Zhang% '

9. Use truncate to delete all data
TRUNCATE TABLE Student-1

Write so many examples just hope that everyone ingenious, this case is a student score table to do the demonstration, in exchange for other tables, the syntax is the same, this article is just a basic T-SQL statement, follow-up will continue to update the use of T-SQL statements.

Creation of tables for SQL Server databases with manipulation of data tables using T-SQL statements

Related 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.