Concept explainers
RIGHT JOIN:
- This type of join returns all the records (rows) from the right table and the matched records (rows) from the left table.
- When the fields of left table do not match with the right one, then the fields are filled with “NULL” values.
Syntax:
SELECT column_Name(s) FROM table_Name1 RIGHT JOIN table_Name2 ON table_Name1.column_Name = table_Name2.column_Name;
In the above syntax, the right table is “table_Name2” and the left table is “table_Name1”.
LEFT JOIN:
- This type of join returns all the records (rows) from the left table and the matched records (rows) from the right table.
- When the fields of right table do not match with the left one, then the fields are filled with “NULL” values.
Syntax:
SELECT column_Name(s) FROM table_Name1 RIGHT JOIN table_Name2 ON table_Name1.column_Name = table_Name2.column_Name;
In the above syntax, the left table is “table_Name1” and the right table is “table_Name2”.
ORDER BY Clause:
SQL contains “ORDER BY” clause in order to sort rows. The values get sorted in ascending as well as descending order. The keyword used to sort values in ascending order is “ASC” and for descending order is “DESC”. By default, it sorts values by ascending order.
Syntax:
SELECT column_Name1, column_Name2 FROM table_Name ORDER BY column_Name2;
Trending nowThis is a popular solution!
Chapter 5 Solutions
A Guide to SQL
- Which of the following characters can be used in a table name? a. b. ( c. % d. !arrow_forwardUse SQL to complete the following exercises. Create a table named SALES_REP. The table has the same structure as the REP table shown in Figure 3-11 except the LAST _NAME column should use the VARCHAR data type and the COMMISSION and RATE columns should use the NUMBER data type. Execute the command to describe the layout and characteristics of the SALES_REP table.arrow_forward
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology PtrDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781305627482Author:Carlos Coronel, Steven MorrisPublisher:Cengage Learning
- Database Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781285196145Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos CoronelPublisher:Cengage LearningNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage