T-SQL And General SQL: Unit 1 - Introduction To SQL Queries
Approved & Edited byProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
T-SQL: What keyboard shortcut do you use in sql server management studio to execute an sql statement?
Explanation Pressing the F5 key in SQL Server Management Studio allows the user to execute an SQL statement. This shortcut is commonly used to quickly run queries and commands without the need to manually click on the execute button.
Rate this question:
4.
T-SQL: You have a table with a colum entitled 'job', whose values are all lower case. If you execute the following query:
SELECT ename, job, deptno
FROM dbo.emp
WHERE job = 'CLERK'
you will not get any results back buecase the match is case sensitve and so because all values of the 'job' colum are lowercase, uppercase 'CLERK' will not be found.
A.
True
B.
False
Correct Answer
B. False
Explanation With SQL Server, the match is not case sensitve
Rate this question:
5.
SQL: what operator is used to perform a search that matches a range of values?
Correct Answer BETWEEN between Between
Explanation The operator used to perform a search that matches a range of values in SQL is "BETWEEN". It is case-insensitive, so it can be written as "between" or "Between" as well. This operator is commonly used in SQL queries to specify a range of values for a particular condition, such as selecting records with values between a certain minimum and maximum value.
Rate this question:
6.
SQL: What operator(s) can be used to perform a search that is not in a specified range of values?
Correct Answer NOT BETWEEN Not Between not between Not between not Between
Explanation The correct answer is "NOT BETWEEN". This operator is used in SQL to perform a search that is not within a specified range of values. It allows you to exclude values that fall between two given values. The case sensitivity of the operator does not matter, so it can be written as "Not Between", "not between", "Not between", or "not Between" as well.
Rate this question:
7.
SQL: What operator is used for negation?
Correct Answer NOT not Not !
Explanation The operator used for negation in SQL is "NOT". It can be written in lowercase as "not" or in title case as "Not". Another symbol that can be used for negation is the exclamation mark "!".
Rate this question:
8.
SQL: What operator is used to compare against null values?
Correct Answer IS NULL is null Is Null
Explanation The operator "IS NULL" is used to compare against null values in SQL. It can be written in lowercase or uppercase letters, as "is null" or "Is Null". This operator is used to check if a value is null or not, as null values cannot be compared using the regular comparison operators such as "=", ">", "
Rate this question:
9.
SQL: What operator(s) is used to compare against values that are not null?
Correct Answer IS NOT NULL is not null Is Not Null
Explanation The operator "IS NOT NULL" is used in SQL to compare against values that are not null. This operator is case-insensitive, so it can be written as "is not null" or "Is Not Null" as well. It is used in conditional statements to filter out rows where a particular column does not have a null value.
Rate this question:
10.
SQL: What operator would you use to compare against values that are not null?
A.
NOT NULL
B.
NOT IS NULL
C.
IS NOT NULL
D.
!NULL
Correct Answer
C. IS NOT NULL
Explanation The IS NOT NULL operator is used in SQL to compare values that are not null. It returns true if the value is not null and false if the value is null. This operator is commonly used in WHERE clauses to filter out null values from the result set.
Rate this question:
11.
SQL: What operator would you use to compare against values that are not like other values?
A.
NOT LIKE
B.
IS NOT LIKE
C.
NOT IS LIKE
Correct Answer
A. NOT LIKE
Explanation The NOT LIKE operator is used in SQL to compare values that are not similar to other values. It allows for the comparison of strings based on patterns, where the specified pattern does not match the values being compared. This operator is useful when you want to retrieve records that do not have a specific pattern or do not match a certain string.
Rate this question:
12.
SQL: What operator would you use to find values that are not in a specified list?
A.
NOT IN LIST
B.
NOT IN
C.
IS NOT IN
Correct Answer
B. NOT IN
Explanation The NOT IN operator is used to find values that are not present in a specified list. It is commonly used in SQL queries to filter out records that do not match the values provided in the list. By using the NOT IN operator, you can easily exclude specific values from the result set based on your criteria.
Rate this question:
13.
SQL: What does the wildcard expression % stand for?
Correct Answer zero or more characters
Explanation The wildcard expression % in SQL stands for zero or more characters. This means that when using the % wildcard in a SQL query, it can match any sequence of characters of any length. It is commonly used in conjunction with the LIKE operator to perform pattern matching in SQL queries.
Rate this question:
14.
SQL: What does the wildcard underscore operator (_) stand for?
Correct Answer any one character
Explanation The wildcard underscore operator (_) in SQL is used to represent any single character. It can be used in a query to match a single character in a specific position within a string. For example, if we have a column with values like "cat", "bat", and "hat", we can use the underscore operator to search for all three-letter words that end with "at" by using the pattern '_at'. This will return all the matching rows with values "cat", "bat", and "hat".
Rate this question:
15.
SQL: What operator do you use to perform wildcard matches?
Correct Answer LIKE
Explanation An example is as follows:
SELECT ename, job, deptno
FROM dbo.emp
WHERE ename LIKE 'M%'
Rate this question:
16.
SQL: What is the 'not equals' operator?
Correct Answer <>
Explanation The 'not equals' operator in SQL is represented by the symbol ''. It is used to compare two values and returns true if the values are not equal, and false if they are equal. It is commonly used in SQL queries to filter out specific values that do not match a certain condition.
Rate this question:
17.
T-SQL: A column name can be specified without using the 'AS' keyword as folows:
SELECT sal*1.10 new_sal
FROM dbo.emp
A.
True
B.
False
Correct Answer
A. True
Explanation Either
SELECT sal*1.10 new_sal
FROM dbo.emp
or
SELECT sal * 1.10 AS new_sal
FROM dbo.emp
is valid.
Rate this question:
18.
SQL: What are the purposes of the * symbol in a SELECT statement?
19.
T-SQL: Write the SQL to list all employees (empno, sal) whose salary (sal) is between 1000 and 2000. The table in question is called 'emp'.
20.
T-SQL: Write the SQL to display each of the different types of occupation (i.e. each occupation only once). The table in question is called 'emp', and the occupation column is called 'job'
21.
T-SQL: Write the SQL to display all the employees who were recruited during 1983 giving their name (ename), department number(deptno) and hire date(hiredate). The table in question is 'emp', with the default owner.
22.
T-SQL: Write the SQL to find the names (ename), jobs (job) and salaries (sal) of all employees who do not have managers (mgr). The table in question is called 'emp', with the default owner.
23.
T-SQL: Write the SQL to list the jobs (job) and department numbers (deptno) of employees whose names (ename) ends with s. The table in question is called 'emp' with the default owner.
24.
T-SQL: Find employees (ename, job) who are not managers or the president. The table in question is 'emp', with the default owner
25.
T-SQL: Write the SQL to work out what percentage of salary (sal) the commission (comm) is for an employee who earns commission. The table in quesiton is called 'emp', with the default owner.
26.
T-SQL: Write the SQL to list the department number (deptno), name (ename), job (job) and salary (sal) of all employees, firstly in department number (deptno) order and then in salary (sal) order, showing the highest salary for each department first. The table in question is called 'emp', with a default owner.
Quiz Review Timeline +
Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.