USING
USING in SQL is a clause that is utilized in join statements, specifically for equi-joins, to specify columns on which the join should be performed. This clause helps in reducing redundancy when using joins by ensuring unique column names in the result set. It allows for more concise SQL queries.
Example
Output
Explanation
In this SQL statement, SELECT * FROM Employees;
is executed, which selects all the data from the Employees
table. The ‘Output’ section shows the table displaying the result of the previous SQL statement. The table includes columns ‘ID’, ‘Name’, ‘Department’. The rows show the data of each employee in the ‘Employees’ table.
Example
Output
Explanation
The SQL code defines a table ‘Employees’ and inserts a record into it. The output shows the resulting table as rendered in markdown, with one record for employee ‘Tom’.
Example
Output
Explanation
The SELECT statement retrieves values from the database. Here, a string ‘Hello, World!’ is selected and given the alias Greeting. The FROM clause indicates the table where the SQL statement will look for the data. In Oracle, Dual is a special one-row, one-column table present by default. The output is a single record with a single column named Greeting that contains the string ‘Hello, World!’.
Example
Markdown:
Output
Markdown:
Employee_ID | First_Name | Last_Name | Salary |
---|---|---|---|
3 | John | Doe | 60000 |
5 | Jane | Smith | 75000 |
Explanation
The SELECT command is used to select data from a database. Here, it selects all the fields (*) from ‘Employees’ table where the ‘Salary’ field is greater than 50000. The result is a table that includes rows for ‘Employee_ID’, ‘First_Name’, ‘Last_Name’ and ‘Salary’ where the salary is more than 50000.