Advanced SQL

Top number of records

SELECT column_name
FROM table_name
LIMIT 5;

Like/Not Like

SELECT * FROM Customers
WHERE Country NOT LIKE '%land%';

In

SELECT column_name
FROM table_name
WHERE column_name IN ('value1', 'value2',...);

Between.. And..

SELECT column_name
FROM table_name
WHERE column_name BETWEEN 'value1' AND 'value2';

Inner Join

Advanced SQL

SELECT column_name
FROM table1
INNER JOIN table2
ON table1.column_name=table2.column_name;

or

SELECT column_name
FROM table1
JOIN table2
ON table1.column_name=table2.column_name;

Left Join

Advanced SQL

SELECT column_name
FROM table1
LEFT JOIN table2
ON table1.column_name=table2.column_name;

or

SELECT column_name
FROM table1
LEFT OUTER JOIN table2
ON table1.column_name=table2.column_name;

Right Join

Advanced SQL

SELECT column_name
FROM table1
RIGHT JOIN table2
ON table1.column_name=table2.column_name;

or

SELECT column_name
FROM table1
RIGHT OUTER JOIN table2
ON table1.column_name=table2.column_name;

Full Outer Join

Advanced SQL

SELECT column_name
FROM table1
FULL OUTER JOIN table2
ON table1.column_name=table2.column_name;

  

上一篇:oracle 查询及删除重复记录的SQL语句


下一篇:selenium自动化之元素高亮显示