SQL Server advanced content table expressions and review 1. table expression (1) uses a table as a source or a query result set as a source to process the source and obtain a new data source for query. (2) (3) to derive a table, use the result set obtained by the table query as a new data source. Note the following points: 1) the derived table must
SQL Server advanced content table expressions and review 1. table expression (1) uses a table as a source or a query result set as a source to process the source and obtain a new data source for query. (2) (3) to derive a table, use the result set obtained by the table query as a new data source. Note the following points: 1) the derived table must
SQL Server advanced content table expressions and review
1. Table expression
(1) Use a table as a source or query result set as a source, process the source, and then obtain a new data source, Hong Kong server, and server space, query it.
(2)
(3) A derived table, a Hong Kong Vm, uses the result set obtained from the table query as a new data source. Pay attention to the following points:
1) The derived table must be enclosed in parentheses.
2) aliases must be obtained for the derived table.
3) all fields in the derived table must have aliases.
4) only result sets that can be used as derived tables (cursors do not work ).
(4)
(S1.stuID, 6 7 s1.stuName, s1.stuSex stuSex, (yy, Baidu, getdate () as stuAge, (varchar (10), s1.studydate, 101) as stuStudyDate, 20 21 s1.stuEmail, 22 23 s1.stuPhone, 24 25 s2.testBase, 26 27 s2.testBeyond, 28 29 s2.testName, (varchar (10), s2.testDate, 101) as testDate, 32 33 s3.className, 34 35 s3.classDescriptionStudent as s1Score as s2s1. stuID = s2.stuIDCourse as s3s1. classID = s3.classIDs1. stuIsDel) as tb1tb1. stuAgetb1.stuSex
2. Some knowledge points of SQLHelper
(1) SqlConnection is used to connect to the database
(2) SqlCommand is used to execute SQL statements
1) parameterized query: SqlParameter
2) Execution Method
-> ExecuteNonQuery (): Execute add, delete, modify, and return the number of rows affected at the beginning.
-> ExecuteScalar ()
-> ExecuteReader () returns DataReader
(3) SqlDataReader is used to read each piece of data.
(4) SqlDataAdapter encapsulates all the above classes
Posted on