Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The creation of tables in SQL server Database and the manipulation of data tables using T-SQL statements

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The creation of tables and the use of T-SQL statements one, table creation and basic concepts A table is a database object that contains all the data in the database, and the table definition is a collection. Data is organized in a table similar to that in a spreadsheet, both in row and column format. Each row represents a unique record, and each column represents a field in the record. The table in SQLserver contains the following major components * columns: each column represents a property of the object modeled by the table, for example, a product table has id column, color column and weight column # rows: each row represents a separate instance of the object modeled by the table

Data type

Creation of tables

Manipulate the datasheet using T-SQL statements

1. Inquire about Wang Ming's achievements? Result: Wang Ming 90

Select name, score from student-1 name = 'Wang Ming'

2. Add 2 points to Wang Ming?

Update student-1 set score = score + 2 where name = 'Wang Ming'

3. Query the students whose remarks are not empty?

Select from student-1 where remarks is not null

4. inquire about the students whose scores are more than 95 points?

Select from student-1 where score > 95

5. Wang Ming transferred to another school and deleted Wang Ming.

Delete from student-1 where name = 'Wang Ming'

Here comes a new classmate whose name is Wang Guonan.

Insert into student-1

Values (20par 'Wang Guonan', '11111111111111''3' 95' running')

7. Inquire about the GPA?

Select avg (grade) as GPA

From student-1

8. Inquire about Zhang?

Select * from student-1

Where name like 'Zhang%'

9. Delete all data using truncate

Truncate table student-1

Write so many examples just in the hope that you can learn and use them. In this case, the student score sheet is used to demonstrate. If you change to other tables, the grammar is the same. This article only explains the basic T-SQL statements, and will continue to update the use of T-SQL statements in the future.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report