WorksheetsInduction_Training_2
Total questions: 71
Worksheet time: 43mins
Given table has 100 tuples and write a query to find out only 50 tuples from given table (only first half records).
SELECT TOP FIRSTHALF * FROM Bikes;
ELECT TOP 1/2 *
FROM Bikes;
SSELECT TOP
HALF * FROM Bikes;
SELECT TOP 50 PERCENT * FROM Bikes;
Write a query and find out number of unique salaries and return unique salary from EMP table.
SELECT COUNT (UNIQUE Emp_Salary) AS Unique_Salary FROM Employee ;
SELECT COUNT (DISTINCT Emp_Salary) ,Salary FROM Employee ;
SELECT AS Unique_Salary , COUNT (DISTINCT Emp_Salary) FROM Employee ;
SELECT COUNT (DISTINCT Emp_Salary) AS Unique_Salary FROM Employee ;
Which query will “find out two employees who came from Delhi”?
SELECT TOP 2 * FROM Employee WHERE Emp_City = Delhi ;
SELECT 2 * FROM Employee WHERE Emp_City = Delhi ;
SELECT * FROM Employee WHERE Emp_City = Delhi AND Emp_City<2;
SELECT TOP 2 * Employee WHERE Emp_City = Delhi ;
Which query will help us to select a random record from table?
SELECT column FROM table ORDER BY NEWID()
SELECT RANDOM column FROM table ORDER BY NEWID()
SELECT TOP 1 column FROM table ORDER BY NEWID()
SELECT TOP 1 column FROM table AS NEWID()
Write a query to find out total sales but total sales greater then 300 from department table?
SELECT department, SUM (sales) AS "Total Sales"
FROM order_details
GROUP BY department WHERE SUM (sales)>300;
SELECT department, SUM (sales) AS "Total Sales"
FROM order_details
GROUP BY department HAVING SUM (sales)>300;
SELECT department, SUM (sales) AS "Total Sales"
FROM order_details
GROUP BY sales HAVING SUM (sales)>300;
SELECT * SUM (sales) AS "Total Sales"
FROM order_details GROUP BY department HAVING SUM (sales)>300;
Write a query and return all records from Table A and Table B.
SELECT Distinct *
FROM table_A
FULL OUTER JOIN table_B
ON table_A.A = table_B.A;
SELECT (Distinct *)
FROM table_A
FULL OUTER JOIN table_B
ON table_A.A = table_B.A;
SELECT *
FROM table_A
JOIN table_B
ON table_A.A = table_B.A;
SELECT *
FROM table_A
FULL OUTER JOIN table_B
ON table_A.A = table_B.A;
We have two tables, Table-1 and Table-2. Column id is common attribute in both tables. Also, only 5 ID are matches in both tables. So, here is the question.
Table-1 has 6 tuples and table-2 has 7 tuples. If we will perform cross join on these tables then, how many tuples will return?
30
5
42
13
If a set is a collection of values given by the select clause, The ______ connective tests for set membership.
within
Include
Under
IN
Which of the below is an invalid query?
SELECT Unique(name) FROM DataFlair;
SELECT * FROM DataFlair Where experience!=0;
Select name FROM DataFlair;
Find out which query gives an error.
select * from Grades where not Grade = '1' ;
select * from Grades where not Grade =1 ;
select * from Grades where Grade not like '1' ;
select * grades where grade = 1 and grade = 11;
Find out which query will give second highest salary (Multiple choose Questions).
SELECT First_name, Max(salary) AS salary FROM employee WHERE salary in (select salary from employee minus select max(salary) from employee);
SELECT First_name, Max(salary) AS salary FROM employee WHERE salary != ( select max(salary) from employee);
SELECT First_name, salary AS salary FROM employee WHERE 1 > ( select Count( DISTINCT salary) FROM employee);
Find out which query will give an error from options?
SELECT * FROM Employee WHERE Salary BETWEEN '50000' AND '100000';
SELECT * FROM Employee WHERE Salary BETWEEN '50000' OR '100000';
SELECT * FROM Employee WHERE Salary in ( '50000') AND salary in ( '100000');
SELECT * FROM Employee WHERE Salary = '50000' AND Salary = '100000';
Write a query to find the employees name whose name start with ‘S’.
SELECT * FROM Employee WHERE First_name Match'S%';
SELECT * FROM Employee WHERE First_name = 'S%';
SELECT * FROM Employee WHERE First_name in ('S%');
SELECT * FROM Employee WHERE First_name LIKE 'S%';
What is a Self-Join?
Joining to column
Joining two difference table
Cross joining two
Joining one table with same
What is sequence of clauses used with SELECT query in SQL?
WHERE clause ,ORDER BY clause,GROUP BY clause,HAVING clause
WHERE clause ,GROUPBY clause,HAVING clause,ORDER BY clause
ORDER BY clause, GROUP BY clause, HAVING clause, WHERE clause
WHERE clause, GROUP BY clause, ORDER BY clause, HAVING clause
What does BLOB in SQL stand for?
Binary Large Object
Big long object
Binary language for object
What does the following statement in SQL do?
truncate table student ;
delete the student table
drop the student table
delete all record
create a student table
_____removes all rows from a table without logging the individual row deletions.
DELETE
DROP
TRUNCATE
REMOVE
What is the purpose of the SQL AS clause?
The AS SQL clause is used to change the name of a column in the result set or to assign a name to a derived column
The AS clause is used with the JOIN clause only
The AS clause defines a search condition
Which data type can store unstructured data in a column?
RAW
VARCHAR
NUMERIC
CHAR
A subquery in an SQL SELECT statement is enclosed in___.
parenthesis -- (...).
brackets -- [...].
CAPITAL LETTERS
braces -- {...}.
What is the output of the given query?
If, Table Employee has 10 records. It has a non-NULL SALARY column which is also UNIQUE.
SELECT COUNT(*) FROM Employee WHERE SALARY > ANY (SELECT SALARY FROM EMPLOYEE);
10
9
8
7
SQL Views are also known as____.
Simple tables
Virtual tables
Complex tables
Actual Tables
_______ is a constraint that can be defined only at the column level?
UNIQUE
NOT NULL
CHECK
PRIMARY KEY
Which statement is true regarding routines and triggers?
Both run automatically.
Both are stored in the database.
Both consist of procedural code.
Both have to be called to operate.
Choose correct option to rename database name:
RENAME old_database TO new_database;
RENAME DATABASE old_database TO new_database;
What id Difference between DELETE and TRUNCATE statement?
Both commands delete all the rows and free the space containing by table.
DELETE command deletes rows based on specified condition and free the space.
TRUNCATE command deletes all the rows and free the containing space by table.
With SQL, how can you return number of records in the “Student”Table?
SELECT ALL(*)from Student;
SELECT Columns(*) from Student;
SELECT LEN(*) from Student;
SELECT COUNT(*) from Student;
Choose incorrect characteristic of PRIMARY KEY
Primary key always has unique data.
Primary key length cannot ne exceeded than 900 bytes.
Primary key cannot have null value.
Primary key doesn’t enforces an entity integrity of the table
Choose correct answer about where clause and having statement.
Both are used to filter the records from a group
Where clause filter records before groupings are made and having filter
Records from a group.
Both can use logical connectives like OR, AND, etc.
Which SQL statement is used to return only different values?
SELECT DIFFERENT
SELECT DISTINCT
SELECT UNIQUE
How can you change “Sagar” into “Jayesh” in the “Last_name” column in Person table?
UPDATE Person SET Last_name=”Sagar” into Last_name=”Jayesh”;
MODIFY Person SET Last_name=” Jayesh” WHERE Last_name=” Sagar”;
MODIFY Person SET Last_name=”Sagar” into Last_name=”Jayesh”;
UPDATE Person SET Last_name=”Jayesh” WHERE Last_name=”Sagar”;
The minimal set of super key is called______________.
Primary key
Secondary key
Candidate key
Foreign key
The distinguishable parts of record are called___________.
Files
Data
Fields
Database
A _____ means that one record in a particular record type can be related to Many records in another record type and vice versa.
One-to- one relationship
One-to- many relationship
Many -to- one relationship
Many -to- Many relationship
Which of the following clause cannot be used in SQL sub queries?
GROUP BY
ORDER BY
DELETE
FROM
Which one if these is used to put the same value in all the rows?
Group by unique column
Group by single column
Group by one column
Group by same value
Select the syntax of Single Line Comment.
.
!
--
---#
If multiple columns are used as Primary Key, it is known as_____________.
Unique
Composite
Foreign
SELECT COUNT (____ ID) FROM teaches WHERE semester = ’Spring’ AND YEAR = 2010;
If we do want to eliminate duplicates, we use the keyword ______in the aggregate expression.
Distinct
Count
Avg
Primary key
You attempt to query the database with this command:
select nvl (100 / quantity, none) from inventory;
Why does this statement cause an error when QUANTITY values are null?
The expression attempts to divide by a null value
The character string none should be enclosed in single quotes (' ')
A null value used in an expression cannot be converted to an actual value
he data types in the conversion function are incompatible
How many sizes of headers are available in HTML by default?
5
1
3
6
What is the smallest header in HTML by default?
h1
h2
h6
h4
What are the types of lists available in HTML?
Ordered, Unordered Lists.
Bulleted, Numbered Lists.
Named, Unnamed Lists.
How to create an ordered list in HTML?
<ul>
<ol>
<href>
<b>
HTML files are saved by default with the extension?
.html
.h
.ht
We enclose HTML tags within?
{}
<>
!!
What is the effect of the <b> tag?
It converts the text within it to bold font.
It is used to write black-colored font.
It is used to change the font size.
What is meant by an empty tag in HTML?
There is no such concept of an empty tag in HTML
An empty tag does not require a closing tag
An empty tag cannot have any content within it
What are the attributes used to change the size of an image?
Width and height
Big and Small
Top and bottom
Which attribute is used to provide a unique name to an HTML element?
id
class
type
Which of the following properties is used to change the font of text?
font-family
font-size
text-align
What tag is used to render an image on a webpage?
img
src
image
Apart from <i> tag, which of the following tag is used to render a text in italics?
<em>
<strong>
<b>
Colors are defined in HTML using?
RGB Values
HEX Values
RGBA values
All of the above
Which property is used to set colors in HTML?
color
background-color
font-color
text-color
Which property is used to set border colors in HTML?
border-color
border
Both A and B
Which of the following things are necessary to create an HTML page?
A text editor
Web Browser
Both A and B
Which of the following tags is used to indicate the page’s start and endpoints?
<body>
<html>
<head>
<doctype>
Which HTML tag is called the root element of an HTML document?
<html>
<body>
<title>
<head>
How is black color represented in terms of RGB values?
RGB(0, 0, 0)
RGB(100, 100, 100)
RGB(100, 100, 0)
RGB(100, 0, 0)
How to set a font for a whole page?
<targetfont>
<defaultfont>
<font>
Which of the following colors contain equal amounts of RBG?
White
Gray
Black
All of the above
Which of the following tags is used to add a row to a table in HTML?
<tr>
<td>
<th>
Which property allows an image link to show a text label?
alt
str
alternative
Which HTML tag is used to set up a Javascript-like client-side scripting language?
<script>
<select>
<anchar>
Which of the following is correct about HTML?
HTML uses User Defined Tags.
HTML uses tags defined within the language.
Both A and B
The correct sequence of HTML tags for starting a webpage is -
Head, Title, HTML, body
HTML, Body, Title, Head
HTML, Head, Title, Body
HTML, Head, Title, Body
Which of the following tag is used to insert a line-break in HTML?
<br>
<a>
<pre>
<b>
_____ tag defines the description list.
<dl>
<dt>
<td>
. A subquery in an SQL SELECT statement is enclosed in:
parenthesis -- (...).
brackets -- [...].
CAPITAL LETTERS
braces -- {...}.
