+------+------+------------+--------------------+
|
id | name | work_date | Salary
|
+------+------+------------+--------------------+
| 1 | John | 2007-01-24 | 250 |
To get output like 1John2007-01-24 which of the following
function can be used?
CONCAT
How to get count of all records in a table?
Select
count(*) from table_name
Q Which type of values are ignored by the group functions?
Null values
Q Which of the following functions is/are not scalar?
Case, mcase
Q What will be the output of the following query?
select (round(3.5 mod 4))
4 - Query is not correct
What will the output of following query?
Select
substring(“987654321”, INSTR(‘foobar’.’o’),5) from DUAL
87654
Which of the following command work as per below statement?
“we need to replace a string named “foo” with “bar” in a
column having ID <= 4”
UPDATE
table_name
Set
column_name = REPLACE(column_name,’foo’,’bar’)
Where ID
<=4;
Q Which of the following functions are related to XML?
XMLTable,
PATH
Q For a table with the following columns:
Product_id, product_name, supplier_id, price
Which of the followings queries will give you the supplier
with the maximum average price of products?
Select
supplier_id, max(avg(price)) from products group by supplier_id
Q What keyword is used to filter values obtained by applying
aggregate functions in the query results using GROUP by clause?
HAVING?
Q Which of the following is correct for Third Normal Form?
Every
non-prime attribute of relation is non-transitively dependent on every key of that
relation
Q Which of the following is an SQL operator?
LIKE
EXPLAIN
PLAN
Q Consider the
following Attendance table, which contains employee attendance record for a
company:
EmployeeId(Int) , LoginTime (time) , logouttime(time)
Which of these SELECT statements will list the employee ID
that has logged-in most recently ?
SELECT TOP
1 a.EmployeeID FROM Attendance a
WHERE
a.LoginTime = (SELECT MAX(b.LoginTime) FROM Attendance b)
Q Which of the following is not a DML command ?
SEARCH
Q Which of the following constraints work together to
arrange data in normal form (normalization)?
Foreign Key
NOT NULL
Q SQL language developed by:
Donald
Chamberlin
Q Which of the following can be used to fetch
only distinct rows from a table?
DISTINCT
Q Which of the
following are subset of SQL
DDL , DML
Q Which of the following is not a logical operator?
ABOVE
Q Which of the
following will return all rows from left table (table1) with matching rows in
right table (table2)?
Select
column_name(s) FROM table1 LEFT join table2 ON table1.Column_name =
table2.columnname
Q Which of the following SQL statements can be used to
update a VIEW?
No special
statements needed and views can be updated using INSERT
Q Which of the following JOIN can be used to returns all
rows from multiple tables where the join condition is met?
INNER JOIN
Q Primary key is a combination of two constraints?
NOT NULL
and UNIQUE
Q Which of the following statements are true?
Alter, drop
are DDL commands
Q Which of the following can have an alias?
A TABLE
A COLUMN
Q Which of the following constraints can be used while
creating tables?
NOT NULL
UNIQUE
Q To create a column in table with fixed length (n) string
which of the following data type is recommended?
VARCHAR
CHAR
Q Which of the following can be used to delete all rows from
a table?
TRUNCATE
TABLE table_name
Q a table customers has 30 records. The column ‘Monthly_Income’
29
Q Which one of the following is correct to delete a column
from a table?
ALTER TABLE
table_name DROP COLUMN column_name
Q Which of the following is true about commit command?
Executing
commit without begin transaction will result in a error
Q to create a table student with primary key ‘ID’ which of
the following statement can be included in create table command?
CONSTRAINT [PK_Marks] PRIMARY KEY ( [Id] ASC)
Q Which of the following is the name of ** operator
Exponentiation
Q Which of the following is correct syntax for writing sub
query?
select sub.* from (select * from Students where Name = 'F001B') sub
where sub.Class ='F1761'
Q Which of the following types are varieties of DML?
Procedural
Declarative
Imperative
Interrogative
Q If subquery in WHERE clause returns multiple rows we can
only use one of the following operator?
IN
Q This set of Database Questions & Answers focuses on
“Relational Database and Database Schema”
1.
A relational database consists of a collection
of
a) Tables
b) Fields
c) Records
d) Keys
a) Tables
b) Fields
c) Records
d) Keys
A
Q If the elements of a domain are ____ units, then the
domain is said to be an atomic domain.
Indivisible
Q Identify the composite attributes
a) Salary
b) Credits
c) Section_id
d) None of the mentioned
Q Relational Database Management System concepts were developed by _____
Edgar F. Codd
Q SELECT TableA.Column1 FROM TableA INNER JOIN (SELECT Column1 FROM TableB WHERE TableB.Column1 IS NOT NULL) TableC INNER JOIN ON TableA.Column1 = TableC.Column1
Consider the above SQL query ran on an nt-standard RDMS,
which of the following SQL statements will always give the same result:
None of above
Q Which of the following statements is used to remove an index from a table?
DROP INDEX
Q Which of the following is not as aggregate function available in SQL?
MEAN
Q Is there difference between AND and & (ampersand) in SQL?
AND priority is higher than &;
Q If a column is defined as decimal (5,2), what does that mean?
A number that has 3 digits before the decimal and 2 digits after the decimal
Q All statement in in SQL end with
Semicolon
Q Consider the following table A with two columns col1 and column2.The records in the table are:
Col1 Col2
A F
B E
C D
D C
E B
F A
What will be the result of the following SELECT statement:
SELECT Col1 FROM A ORDER BY COL2, COL1 DESC
f
e
d
c
b
a
Q Which statement is used to delete a table from a database?
DROP table
Q Which of the following operators can be used to check if a columns contains NULL value?
IS NULL
Q Referential integrity means that among relations
A record cannot be deleted if it has any associated data.
Q Which of the following is not a comparison operator in SQL?
==
Q For a table of the following data
Name Marks
John 400
Brown 200
Darwin 350
Kamy 250
Which of the following queries will give you names of all
students have above average marks?
select * from Student where Marks > (select avg(Marks) from [dbo].[Student])
Q Which of the
following commands can use a foreign key constraint? (Check any that apply)
Create
Alter
Q Which of the following is correct for third Normal Form?
Every non-prime attribute of relation is non-transitively dependent on every key of that relation.
Q Which of the following clauses can be included in SELECT to fetch 10 records only?
Top 10
Q Consider two tables A and B having only one column each
and having these values:
A = [0,1,2,3,4,5]
B = [5,6,7,8,9,10]
The number of records in result of UNION operator on these table will be?
11
Q Which of the following constraints can be used while creating tables?
NOT NULL
UNIQUE
AUTO
INCREMENT
Q IF AND and OR are used after WHERE clause …
AND has higher priority;
Q Suppose a table
CUSTOMERS has the following records :
1
|
RAMAN
|
150000
|
2
|
Andrew
|
200000
|
3
|
Christi
|
240000
|
4
|
Ivan
|
240000
|
5
|
John
|
240000
|
6
|
Ann
|
240000
|
NULL
|
NULL
|
NULL
|
Which of the following statements will select the customers
with income more than 200000?
select * from customers where id in (select id from customers where income > 200000)
Q The commands TRUNCATE and RENAME are example of :
DDL
Q Which of the following JOIN can be used to return all rows from multiple tables where the join condition is met?
INNER JOIN
JOIN
Q Which of the wildcards available in SQL?
Percent Sign (%)
Underscore
(_)
Q Which of the following is only work with GROUP BY?
HAVING
Very helpful.
ReplyDeleteThanks..
ReplyDeleteGood Practice