SELECT * FROM Txt1
SELECT * FROM Txt2
SELECT * from TXT1 where name in (select name from txt2 where chk = 0)
SELECT * from TXT1 where name is not in (select name from txt2 where chk = 0)
SELECT * FROM Txt1 inner join txt2 on txt1.name = Txt2.name
SELECT * from txt1 LEFT join txt2 on txt1.name = Txt2.name
SELECT * from Txt1 right join txt2 on txt1.name = Txt2.name
SELECT * from txt1,txt2 where txt1.name = Txt2.name Order by txt2.id Desc
Select Txt1.name,sum (txt1.sumint) from txt1,txt2 where Txt1.name =txt2.name Group by Txt1.name
Select count (txt1.name), sum (sumint) from Txt1,txt2 where Txt1.name =txt2.name have sum (sumint) <10
Select count (txt1.name), sum (sumint) from Txt1,txt2 where Txt1.name =txt2.name have sum (sumint) >50
SELECT * from Txt1,txt2 where Txt1.name <>txt2.name Order by Txt1.name Compute Sum (sumint) by Txt1.name
Insert INTO TXT3 select Name,sumint from Txt1
In: Equivalent connection, used to find records of the same field in multiple tables
Not in: Non-equivalent connection, used to find records that do not exist
Inner join: Internal connection, used primarily to find records that are eligible
Left join: To find the right side, mainly for the left.
Right join: Use to find the left side, mainly to the right, with NULL to express
ORDER BY: Ascending ASC Descending desc
GROUP BY: Grouping Sort by field (for example, by Class), using an aggregate function exists
Having: to judge a grouping condition, use it to make sure that each field is using the aggregate function
COMPUTE by: Clauses enable you to view both detail rows and summary rows with the same SELECT statement. You can calculate a summary value for a subgroup, or you can calculate a summary value for the entire result set.
The name of the row aggregate function; For example, SUM, AVG, MIN, MAX, or COUNT
INSERT INTO: Inserts the query's statement into the new table primarily.
Data for TXT1 tables
ID Name Sumint
1 Sheets 355
2 Li 485
3 Wang 585
4 Zhao 6,855
Data for TXT2 tables
ID Name CHK
1 Sheets 30
2 Lee 41 1
3 Wang 50
4 Zhao 60
Usage of in and other aspects of SQL statements