Chapter 5 Operational Architecture, Indexes and Views

1. Create a view:
1. Syntax format:
create view view name
as query expression
with check option
2. Create a new view
Select the view in the explorer -> right-click to create
2. Delete and modify the view
1. Graphical interface:
alter view view name
as
select data
Constraints
3. Modify data through the view (add, delete, modify, and check)
1. Note: (1) The select list contains distinct
(2) The select list contains expressions, such as calculated columns, functions
(3) Reference multiple tables in the from clause
(4) Reference non-updatable views
(5) Tables containing group by
4. Index overview:
1. Function: Make an index for key words to speed up the query time
2. Create Index:
(1) Graphical:
Right-click the index -> create a new index
(2) Statement:
create
index index name
on
table name or view name
View column
3. Management index:
statement: drop index table name. Index name
Graphical: directly right-click the index to delete
4. Full text index and table of contents:
The amount of information in the table is particularly large.
Operation: Right-click on the stand-alone table and select the full-text index.
5. Create a schema:
1. Function: Security protection, it needs to be created when there is a lot of content, which is equivalent to a container.
2. Operation: (1) Syntax format:
create schema schema name authorization schema all者
{ owner_name } (2) Graphical interface: open the structure in security, follow the wizard 3. Delete and modify the structure: as shown in the figure: Modify: stand-alone structure you want to modify, right-click the property to modify. Use of delete statement: drop VI. Classification of indexes: (1) Clustered index: equivalent to a phone book, the contents of the table have a certain order, which is helpful for query (2) Non-clustered index: storage location and data storage are different , The two data are not the same, you can create a non-clustered index Chapter 6: Data query and management: 1. Simple select statement: syntax format: select column name into the new table form table where conditions group by group the search results having judgment order by order 2. Sort: order by: summary Ascending order: DESC Descending order: ASC 3. Grouping:






Insert picture description here

















Insert picture description here

1. AVG: refers to the average
2. rollup:: find the average, if it is in accordance with multiple requirements, first press the first one, and then look at the second condition
3. cute: sort the second one first , And then sort the first one, and perform all the values ​​to average.
Fourth, use functions:
1. max (column name): the maximum value in the current value
2. avg: average
3. sum function: sum
4. top + number: top few data
5. having statement:
Insert picture description here
6. Insert data:
Insert into table name (column name)
values ​​(data value) plus single quotes
7. Add a record in a table to another table The code
insert table
select column
from table
where
8. Create a new table, and then output the query result as that table (temporary table)
select column
into new table
from table
where conditions
9.
1.
Insert picture description here
Update statement: (modify)
update table
set
column Name condition
where condition
2. There is from statement:
statement: update table set
from table a jion table b on a. column = b. column
Insert picture description here
Ten. Delect statement: delete data.
Delect from table name
where conditions.
Eleven. Top keyword and top expression:
1. Top first few records (number) keyword
with ties (take out the only equal of the last record)
2 ,percentage:

3. Define first, then use the data.
4. With ties: include the same scores:
Insert picture description here
5. Modify the first few lines of statements:
Insert picture description here
12. Compute clause: summarize the result set.
Syntax format:
compute
(age\ccount\max \min\stdev\stdevp\var\varp)
Example:
Insert picture description here
13. Use the where statement:
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_42485453/article/details/82896303