Select one of the following SQL statements. You need to identify the statement a
ID: 3692156 • Letter: S
Question
Select one of the following SQL statements. You need to identify the statement and the syntax. Finally, provide an example of the SQL statement.
Select with Where clause
Select with Order by clause
Select with Group by clause
Select with Having clause
Insert
Update using columns
Update without columns identified
Delete
Create Schema
Create View
Create Index
Alter Schema
Alter Table
Alter View
Alter Index
Drop Schema
Drop View
Drop Index
Create Trigger (just basic structure) you don't have to provide example with this one
Create Procedure (just basic structure) you don't have to provide example with this one
***please provide answers for one or two SQL statements as early as possible. Thank you.
Select with Where clause
Select with Order by clause
Select with Group by clause
Select with Having clause
Insert
Update using columns
Update without columns identified
Delete
Create Schema
Create View
Create Index
Alter Schema
Alter Table
Alter View
Alter Index
Drop Schema
Drop View
Drop Index
Create Trigger (just basic structure) you don't have to provide example with this one
Create Procedure (just basic structure) you don't have to provide example with this one
***please provide answers for one or two SQL statements as early as possible. Thank you.
Explanation / Answer
Select statement with where clause:
Syntax:
SELECT Column_List
FROM Table_Name
WHERE [condition];
Condition can be expression using comparision or logical operators like >,<,=,LIKE,NOT,etc.,
Example :
Consider the following database:
Emp table:
Ename
Dept
Salary
Doj
King
10
5500
10-02-06
Blake
10
4500
02-03-05
Clark
20
3500
15-05-04
Smith
30
1800
06-01-10
Miller
20
1100
22-12-03
Taylor
30
3500
24-11-11
To select all the employees and their departments who have salary greater than 4000.
SELECT ename,dept
FROM Emp
Where salary>4000;
Output would be:
Ename dept
King 10
Blake 10
To select all the employees working in department number 20:
SELECT ename
FROM Emp
Where Dept=20;
Output would be:
Ename
Clark
Miller
Select statement with grop by clause:
Syntax:
SELECT Column_List
FROM Table_Name
[WHERE conditions]
GROUP BY Column_List;
Example:
To select the different departments with the maximum salary in that department.
SELECT Dept,max(salary)
FROM Emp
GROUP BY Dept;
Output:
Dept MAX(salary)
10 5500
20 3500
30 3500
Ename
Dept
Salary
Doj
King
10
5500
10-02-06
Blake
10
4500
02-03-05
Clark
20
3500
15-05-04
Smith
30
1800
06-01-10
Miller
20
1100
22-12-03
Taylor
30
3500
24-11-11
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.