I missed it.
SELECT * FROM student,score--Cartesian product
you can think of it as a multidimensional function in C #, and every piece of data in each table will be printed with all the data from the second table.
Connections for two tables:
First method (more commonly used)
Select Student.sno, sname, degree
From Student,score---- when querying a column name in two tables, it is sometimes stated that the column in that table is used to indicate the column name (Student.sno).
Where Student.sno=score.sno--a column that is common to a table so that the two tables are connected
The second method of
Select CNO, (select sname from student where Student.sno=score.sno), the degree from score routines are the same, with different locations
The third method of
Select Student.sno, sname,cno,degree from student joins score on Student.sno=score.sno
---//inner join (default)//left join (left table as the primary table)//right join (the right table is the main table)
Connection of three tables
First method (same as above two tables)
Select Student.sno, sname, CNO, degree, name--- if degree+10, name+ ' classmate ' result is: increase in the value of 10 characters after adding students, the value type will be calculated, the string class will be spliced
From Student,score,course---- when the column name of a query is not only present in 1 tables, it is sometimes used to indicate that the point column name (STUDENT.SNO) is the one in the table.
where Student.sno=score.sno
and Score.cno=course.cno
The second method of
Select Student.sno, sname, CNO, degree, name
From student join score
On Student.sno=course.sno
Join Course
On Score.cno=course.cno
Vertical link data types to be consistent
Between two tables with a Union
Give me a chestnut:
Select Tname name, Tsex sex, tbirthday birthday from teacher
Union
Select Sname, ssex,sbirthday from student
SQL Server Table Links query