Question: MS SQL Server - Select, Filter, Sort Instructions Create Transact SQL on the following problems: For example: Question: Display address in tbl_customer where the second
MS SQL Server - Select, Filter, Sort
Instructions
Create Transact SQL on the following problems:
For example:
Question: Display address in tbl_customer where the second letter of city is A and 5th letter of city is O.
Answer: Select Address From tbl_customer WHERE city LIKE '_A__O%'
Please answer 10 questions:
- Select all columns, all records of tbl_Employee table
- Select the first and last name columns, all records of tbl_Employee table
- Select all records, full name of tbl_Employee table. The full name pattern is EmpFirstName, space, and EmpLastName. Alias is Full Name
- Assuming that there is tbl_a table with columns studentname, englishgrade, mathgrade, sciencegrade. Display the Name of student, and the TOTAL grade of english, math, and science of all students. Column alias is Total grade.
- Assuming that there is tbl_a table with columns studentname, englishgrade, mathgrade, sciencegrade. Display the Name of student, and the AVERAGE grade of english, math, and science of all students. Column alias is Average grade.
- From tbl_Department, select all records, all columns as long as the DateAdded is between Jan 1 2015 and Dec 31 2015
- From tbl_Employee, select all records, column alias Full Name (created from EmpFirstName and EmpLastName) as long as the EmpLastName consists of letter "a".
- Assuming that there is tbl_a table with columns studentname, englishgrade, mathgrade, sciencegrade. Display the Name of student, and TOTAL grade of english, math, and science of all students AS LONG AS THE TOTAL GRADE OF 3 SUBJECTS is greater than 80. Column alias is Total grade.
- Select all records, all columns, of a tbl_dept table as long as the DeptID value is 27,2,6
- Let us say there is a table named tbl_nationalUniv, display branch, city, and population fields and sort is first by city in descending order, next is population in ascending order.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
