Concept explainers
SQL:
- SQL stands for “Structured Query Language”.
- The current version of SQL is “ANSI SQL – 92”.
- SQL is not a
programming language. It is text-based and it is also called as data sublanguage.- In order to get SQL as a complete programming language, it should be included in scripting languages like Java, C#, and so on.
- It contains constructs which are used to define and process
database . They are executed using DBMS-supplied command prompt. - Some of the DBMS products provide GUI tools in order to perform tasks are as follows:
- SQL Server
- Oracle Database
- MySQL
Explanation of Solution
Joining tables in SQL:
Joining is done in order to retrieve information from more than one table. In SQL joining is done by finding rows in the two tables that have identical values in matching columns and it is done using “WHERE” clause. One should construct the following SQL commands in order to join the tables.
- In the “SELECT” clause, one should all the column names that the user wants to display.
- In the “FROM” clause, the user should list all the table names that are involved in the query.
- In the “WHERE” clause, the user must restrict the rows that have similar values in matching columns.
Syntax:
SELECT columns FROM table_Name1, table_Name2 WHERE condition;
Example:
Consider two tables name “EMPLOYEE” and “SALARY”. The table “EMPLOYEE” contains details of the employee like “emp_id”, “name”, “age” and the table “SALARY” contains columns like “emp_id”, and “salary”. These two tables can be joined by the following statement.
SELECT emp_id, name, age, salary FROM EMPLOYEE, SALARY WHERE EMPLOYEE.emp_id = SALARY.emp_id;
The above query joins values from two tables.
Want to see more full solutions like this?
Chapter 5 Solutions
A Guide to SQL
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology PtrDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781305627482Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningDatabase 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 Learning