Q:
What would be the output of following query?
belongs to collection: Top 100 SQL server queries Interview questions
Top 100 SQL server queries Interview questions
- Get all students details from the tblstudent table.
- Get first name from the tblstudent using alias name “StudentName”.
- Get first name, last name from the tblstudent table.
- Select student details whose name is “David” from tblstudent.
- Get first name from tblstudent in upper case.
- Get last name from tblstudent in lower case.
- Get unique branch from tblstudent table.
- Write a query to combine FirstName and LastName and display it as “Full Name”.
- Get all student details from tblstudent whose “FirstName” contains ‘a’.
- Get all student details from tblstudent whose “FirstName” start with latter ‘d’.
- Get all student details from tblstudent whose “FirstName” end with ‘a’.
- List all students whose first name start with ‘Ma’ or ‘Da’.
- Get all students details from the tblStudent table order by FirstName Ascending.
- Get all students details from the tblStudent table order by FirstName Descending
- Get all students details from the tblStudent table order by LastName Ascending and Admission fees descending.
- Get position of ‘v’ in name ‘David’ from tblstudent.
- Select firstname from tblstudent with ‘Hello’ prefix.
- Get FirstName from tblstudent after removing white spaces from right side.
- Get FirstName from tblstudent after removing white spaces from left side.
- Get length of FirstName from tblstudent.
- Get FristName from tblStudent table after replacing ‘a’ with ‘$’.
- Get all students details from tblStudent whose first name starts with ‘m’ and name contains 4 letters.
- Get all students details from tblStudent whose first name ends with ‘a’ and name contains 4 letters.
- Get fristname from tblstudent not start with any single character between a-p.
- Get first name, admission year, admission month and admission date from tblStudent table.
- Get student details from tblStudent table whose admission year is “2015”.
- Get student details from tblStudent table whose admission date is after January 31st.
- Get student details from tblStudent table whose admission date is before January 31st.
- Get student details from tblStudent table whose admission month is “January”.
- Get admission date and time from tblStudent table.
- Get database date.
- Get UTC date.
- Get only month part of admission date from tblStudent.
- Get only year part of admission date from tblStudent.
- Get all student details from tblStudent table whose admission date between ‘2015-01-01’ and ‘2016-01-01’.
- Get the first name, last name, current date, admission date and difference between current date and admission date in days.
- Get the first name, last name, current date, admission date and difference between current date and admission date in month.
- Get the first name, last name, current date, admission date and difference between current date and admission date in year.
- Show “AdmissionDate” in “dd mmm yyyy” format, ex- “06 May 2016”.
- Show “AdmissionDate” in “yyyy/mm/dd” format, ex- “2016/05/06”.
- Show only time part of the “AdmissionDate” from tblStudent.
- Select no of students get admission with respect to year and month from tblStudent table.
- Select TOP Nth (any number) admission fees from tblStudent table
- Select second highest admission fees from “tblStudent” table.
- Select TOP 2 Admission fees from tblStudent table
- Select Highest Admission fees from tblStudent table.
- Select Minimum Admission fees from tblStudent table.
- Select FirstName, LastName from tblStudent table in singal column.
- Get students details from “tblStudent” table whose admission fees is less than 15000.
- Get students details from “tblStudent” table whose admission fees is greater than 15000.
- Get students details from “tblStudent” table whose admission fees in between 10000 and 15000.
- Select 5 % of admission fees from sara , 10% of admission fees from Dora and for other 15 % of admission fees as ‘Deducted_Admission_fee’ from tblStudent table.
- Write a query to get how many students exist in tblstudent.
- Write the query to get the branch and branch wise total(sum) admission fees, display it in ascending order according to admission fees.
- Write the query to get the branch and branch wise total(sum) admission fees, display it in desending order according to admission fees.
- Get branch wise average admission fees from “tblStudent” table order by admission fees ascending order.
- Get branch wise maximum admission fees from “tblStudent” table order by admission fees descending order.
- Get branch wise minimum admission fees from “tblStudent” table order by admission fees ascending order.
- Get branch, no of students in a branch, total admission fees with respect to a branch from tblStudent table order by admission fees descending.
- Select no of students joined with respect to year and month from tblStudent table.
- Select FirstName, Lastname, Scholarship amount from tblStudent and tblScholarship table for all students even if they didn’t get Scolarship.
- Select FirstName, Lastname, Scholarship amount from tblStudent and tblScolarship table for those students who got Scolarship amount.
- Select FirstName, Lastname, Scholarship amount from tblStudent and tblScholarship table for those students who got Scolarship amount greater than 1200.
- Select FirstName, Lastname, Scholarship amount from tblStudent and tblScholarship table for those students who got Scolarship amount using right join.
- Select FirstName, Lastname, Scholarship amount from tblStudent and tblScholarship table for all students even if they didn’t get Scolarship amount and set Scolarship amount as 0 for those students who didn’t get Scolarship amount.
- Write a query to find out the studentname who has not received any scholarship amount, and display 0 in front of his name.
- How to select random record form a tblstudent.
- Write a query to create a clone of existing table without using Create Command.
- Write a query to calculate number of T in string ‘TECHSTUDY’.
- What will be the result of the query below?
- What would be the output of the follwing query?
- Write down the query to print first letter of a Name in Upper Case and all other letter in Lower Case.
- Write down the query to display all student name in one cell seprated by ‘,’ example:-“Sara, David, Dora, Jack, Vikram, Ross”.
- Write down the query to create tblstudent table with primary key (studentId)
- How to set Primary key(PK) using Alter command
- How to drop Primary key(PK) using Alter command
- Write a query to add new column in tblstudent
- Write a query to drop Address column in tblstudent
- What would be the output of following query?
- What would be the output of following query?
- What would be the output of following query?
- What would be the output of following query?
- What would be the output of following query?
- What would be the output of following query?
- What would be the output of following query?
- What would be the output of following query?
- What would be the output of following query?
- What would be the output of following query?
- What would be the output of following query?
- What would be the output of following query?
- What would be the output of following query?
- What would be the output of following query?
Answer – c. 2
need an explanation for this answer? contact us directly to get an explanation for this answer