UNIT —- DATABASE MANAGEMENT
Database Management
346. Which of the following constrai
a. UNIQUE
b. FOREIGN
PRIMARY
d. All of above
347. Which is the correct difference between Primary key and Foreign key?
‘a, Atable can have multiple primary key and single foreign key
b. Aprimary key cannot ignore NULL value but Foreign key can
. APrimary key can have duplicate data but foreign key does not
d._ None of the above
348. Which one of the following refers to the copies of the same data (or information) occupying the
memory space at multiple places.
a, Data Repository
b. Data Inconsistency
Data Mining
d. Data Redundancy
349, Which of the following refers to the number of attributes in a relation?
a, Degree
b, Row
Column
d. Allof the above
350. Consider attributes ID, CITY and NAME. Which one of this can be considered as a primary key?
a, NAME
b. ID
«CITY
d. CITY, ID
351. Which of the following is considered as DBMS?
a, Access
b. Oracle
SQLServer
d. Allofthese
352, Whatwill be cardinality and degree for given table ‘coach’?
ignores NULL value?
Coachid | Coachname | Age | Sport | Dateofapp | Pay | Gender
1 Karan 35 Karate 27/03/19 10000 M
2 | Ravine | 34 | Karate | 20/01/20 | 12000 F
3 Kamal 34 | Squash_| 19/02/20 | 20000 M
4 Tarun 33__| Basketball | 01/01/20 | 15000 M
5 Sumeru_| 36 | Swimming | 12/01/20 | 7500 M
6 Anjani 36 | Swimming | 24/02/20 | 8000 F
7 Shamima_| 37 | Squash | 20/02/20 | 22000 F
8 Soumya | 30 | Karate | 22/02/20 | 11000 F
a. cardinality = 7, degree = 8
b. cardinality = 9, degree = 8
. cardinality = 7, degree = 56
d. cardinality = 8, degree = 7
apers, Practical, Projects, MCQs visit: ww.techtipnow.in
eee eee ed353.
354,
355.
356.
357.
358.
359,
360.
361.
See eens at
Rr eee
if degree of relation is 4 that means relation have
a. 4 tuples
b. 4 attributes
c. 4state
d. 4relations
Relational model was developed by
a. EF Codd
b. Richard Stallman
. Guido Van Rossum
d. John Von Neumann
For the given table ‘student’ having fields
admno, rollno, name, class, dob
identify the most suitable field for Primary key
a. Admno
b. Rno
c. Name
d. Class
A database management system is a typeof software
a, System software
b. Application software
c. General software
d. Both (a) and (c)
Which one of the following refers to the copies of the same data (or information) occupying the
memory space at multiple places.
2. Data Repository
b. Data Inconsistency
. Data Mining
d. Data Redundancy
The term ‘Data’ refers to
‘a, The electronic presentation of the information
b. Basic information
c. Raw facts and figures
d. Both (a) and (¢)
Which of the following refers to the number of tuples on a relation?
a. Entity
b. Column
&Cardinality
d. None of the above
In a relation, which of the following refers to the term ‘attribute’?
2. Entity
b. Row
Column
d, Both (b) and (c)
is used to represent the relationship between tables
a. Primary key
b. Foreign key
Unique key
d. Candidate key
DCR oer ace ate ee es See ay
ene ee362.
363.
364,
365.
366.
367.
368.
369.
370.
Order(order_id, ccode, total)
here the order_id, ccode and total are and Order is
a. Relation attribute
b. Attribute, relation
<. Degree, relation
d. relation tuple
Before DBMS information was stored using _
a, Data System
b, Memory System
File System
d. Drive
Storing records using DBMS helps in
a, Eliminates Data Redundancy
b. Maintain data consistency
Controlled data sharing
d. Allof the above
Collection of logically related records are called
a. Information
b. Relation
¢. Database
d. Tuple
1
ensure every tuple is unique in relation
can be applied to only one attribute in a relation
‘cannot accept NULL values
who am 1?
a. Primary key
b. Unique key
c. Foreign key
d. Candidate key
Which of the following is a real life application of DBMS?
a. Inventory Management
b. Banking
Online Shopping
d. Allofthe above
Database schema refers to
‘a, Table name and their fields
b. Relationship among tables
¢. ‘Data stored in tables
d. (a) and (b)
When we define database schema(structure), database state is
a0
boa
Null
d. Equal to degree
In RDBMS, R represents
a, Record
b, Relation
Relational
d. Referential
For Notes, Textbook Solutions, Sample Papers, Practical, Projects, MCQs visit: www.techtipnow.in
eee eee edan.
372.
373.
374,
375.
376.
377.
In arelation tuple represents a
a. Single cell
b. Single row
Single column
d. None of the above
Which following property is not observed with respect to RDBMS?
a, Sequence of attributes in a relation is immaterial
b. Tuples in a relation can be duplicated
. No attribute can have many data value in one tuple
d. NULLis used to represent values that are unknown or non applicable to certain attributes
Restriction on the type of data that can be inserted into the table is.
‘a, Database Schema
b. Database Instance
<. Database Constraint
d, Database Key
Atuple is a unique entity whereas attribute values can be duplicated in the table
a, True
b. False
Depends upon type of record
d. Depends upon the database key
Which of the following is RDBMS?
a. MySQL
b. SQL Server
¢. MongoDB
d. Allof the above
Which of the following represent a vali
a. Access
b. Mysat.
csv files
d. Allof above
Aschool has arrule that each student must participate in a sport activity. So each one should
give only one preference for sport activity. Suppose there are five students in a class, each
having a unique rolino. The class representative has prepared a list of sports preferences as
shown below:
file system to store records
Roling Preference
1 Cricket
2 Football
3 Hockey
a
3
NULL
Volley ball
Null Kabaddi
Kabaddi was not chosen by any student. Is it possible to have this tupl
relation?
the Sport preference
a. Yes
b. No
c. Not Sure
d. Depends upon you
apers, Practical, Projects, MCQs visit: ww.techtipnow.in
eee eee ed378.
379.
380.
381.
According to case of Q 377, Roll No 4 may not be interested in sport; can a NULL value be
assigned to that student’s preference attribute?
a. Yes
b. No
Not Sure
d. Depends upon you
‘An organization wants to create a database CUSTOMER-SALE to maintain following details
about its items and their sale.
CUSTOMER(Ccode, Cname, Cadd)
SALE( SalelD, Itemno, Total)
Name the attributes of CUSTOMER which can be candidate key
a. Ccode, Cname
b. Ccode, Cadd
© Cname, Cadd
d. Ceode
For the case given in Q379, The organization wants to receive details of SALE of a particular
Customer. Name the tables and the key which are required to retrieve this det:
a, Customer, ccode
b. Sale, ceode
Customer and sale, ccode
d. Customer and sale, saleid
For given following tables
‘STUDENT, PROJECT ASSIGNEND
Rollno | Name Cass, Reg_id | Proj_no
1r04_| Sanjay 12 R01 | 102
2 Ram kumar | 12 Ro3__| 102
3 Harish 2 Roa | 103
4 Jaikaran | 12
Find Foreign Key in PROJECT ASSIGNED table
382.
383.
384,
385.
a, Regid
b. Proj_no
c. Both reg_id and Proj_no
d._ No Foreign Key defined
For the given tables of Q381, find the alternate key in table STUDENT.
a, Rolino
b. Regid
Class,
d. Name
is a request to a database for obtaining information in a desired way.
a. Table
b. Query
Report
d. Hosting
In which of the following case NULL value cannot be assigned to the column ROLLNO.
‘a. When the ROLLNO is zero
b, When the ROLLNO is not known
When the ROLLNO is not available
d. When the ROLLNO is not applicable
is used to get the common tuples from two tables.
For Notes, Textbook Solutions, Sample Papers, Practical, Projects, MCQs visit: ww.techtipnow.in
ene eeRRs
De ee eased
aaa:
ne eye
a, Minus
b. Union
c. Cartesian Product
d. Intersection
Answers
346.c_ [347d [308d [349 | 350.b [351d [352d [353b | 35d.a | 355.8
356.b | 357d | 358.c | 359.c_ | 360.c_~—*(| 361.b | 362b | 363.c_ | 364d | 365.b
366. | 367d | 368d | 369.a | 370.c_~—*[ 371.b | 372¢ | 378.¢ | 37d.a__| 375.0
376.0 | 377. | 378.a | 379.b | 380.c_ | 381.a | 382.0 | 383.b | 38d.a | 385.d
Se nace
Sent
Cee
ier
PN era
treme eeeUNIT —- DATABASE MANAGEMENT
Structured Query Language
386. Which of the following is not an SQL command?
a. Create Database
b. Create Table
. Create Query
d. Show Table
387. Atable can have foreign keys
ad
b. 2
Many
dd. Depends on RDBMS
388. In which of the following case DML is not executed?
‘a. When new record is added
b. When existing record is modified
When existing attribute is modified
d. When records are deleted
389, Which is the correct difference between Primary key and Foreign key?
‘a. Atable can have multiple primary key and single foreign key
b. A primary key cannot ignore NULL value but Foreign key can
<. Primary key can have duplicate data but foreign key does not
d. None of the above
390. In SQL ‘FROM clause is used to
a, Define source table name while retrieving records
b. Define Column name while retrieving records:
. Define Criteria while retrieving records
d. Define values while inserting records
391, Which of the following is not an SQL aggregate function?
a. Avg
b. Max
Count
d. All are aggregate function
392, SQL stands for
a, Structured Question Language
b. Structured Query Language
© Super Query Language
d. System Query Language
393. Which of the following is not true about DDL?
a, The retrieval of information stored in database
b, The creation of schema object in database
¢. The deletion of schema object
d. Allare not True
394, DELETE FROM Book where Price <= 2000;
isa type of statement
a, DDL
b. DML
© DCL
d. None
For Notes, Textbook Solutions, Sample Papers, Practical, Projects, MCQs visit: ww.techtipnow.in
eee eee ed395.
396.
397.
398.
399,
table cannot have more than one UNIQUE keys.
a, True
b. False
Depends upon Primary key
d. Depends upon RDBMS
For given table ‘emp’ with following columns
no, ename, sal, dept, designation
Select correct statement to display all records of ‘emp’ in descending order of ename and
within ascending order of dept.
‘2, SELECT * FROM emp ORDER BY ename, dept DESC;
b, SELECT * FROM emp ORDER BY ename, ORDER BY dept DESC;
SELECT * FROM emp ORDER BY ename DESC, dept;
d, SELECT * FROM emp WHERE ORDER BY ename, dept DESC;
Which of the following is not an SQL Constraint?
a. IS NULL
b. Primary Key
Default
d. Check.
Select correct SQL statement t
‘a UPDATE book SET price = price*0.1;
b. UPDATE book SET price = price + price*0.4;
UPDATE book WHERE price = price*0.1;
d. UPDATE book WHERE price = price + price*0.1;
ease price of books by 10% in book table.
For given table ‘sales’ what will be output of following code
SELECT Sname FROM sales WHERE Rank > 4 ORDER BY Sname;
Sid_[sname | Itemsold | Rank
1 | Jagan 300 3
2 | Mohan | 370 2
3 | Safa 244 5
4 [akir 421 1
5 [Ambar | 280 4
a, Shame
safiq
b. Sname
Amber
Safiq
© Sname
Safiq
Amber
d. SName
Jagan
Jakir
Mohan
For Notes, Textbook Solutions, Sample Papers, Practical, Projects, MCQs visit: ww.techtipnow.in
70-For Video Tutorials Please visit: www.youtube.com/c/techtipnow400.
402.
403.
404.
405.
Consider the table ‘Student’ given below:
StudentNo | Class| Name | Game |Grade| Supw | Gradel | Marks
10 7 | Sameer | Cricket| B | Photography! A | 89.78
1 8 Sujit Tennis | A | Gardening | C | 78.79
2 7 | Kamala_|Swimming| 8 | Photography| 8 | 55.89
B 7_| Sudiksha_| Swimming |_C Cooking B | 92.36
4 8 |Veerendra| Tennis | 8 | Literature | C | 88.20
15 9 | Dilharan | Hockey | A | Cooking B | 67.66
Display the name of student who are getting Grade ‘C’ in either Game or Supw
a, Select * from Student where grade = ‘C’ and gradel = ‘C’;
b. Select * from Student where grade = ‘C’ or grade
‘
d
Select name from Student where grade = ‘C’ or grade =
|. Select name,game,supw from Student where grade =‘C’ or grade:
For given table student in Q400 write SQL command to add a new column DOB (date of birth)
a, Alter table student modify DOB date;
b. Alter table student add DOB date;
<. Alter table student create DOB date;
d. Alter table student new DOB date;
For given table student in Q400 list different games offered by school.
a, Select Game from Student;
b. Select Unique(Game) from Student}
Select Distinct(Game) from Student;
d. Select Game from student where Distinct(Game);
For given table Library (Bno, Title, Qty, Price) Display list of books with price ranges 150 to 200
and qty should not be null.
a, Select Title, Price from Library Where Price between 150 Or 200 And aty = NOT NULL
b, Select Title, Price from Library Where Price between 150 And 200 Or aty = NOT NULL
¢. Select Title, Price from Library Where Price between 150 Or200 And qty IS NOT NULL.
d, Select Title, Price from Library Where Price between 150 And 200 And aty IS NOT NULL
Consider the ‘Club’ (coachid, coachname, sport, dateofapp, pay) List name of all coaches with
their date of appointment in descending order.
a, Select * from club order by dateofapp DESC
b. Select coachname, dataofapp from club order by dateofapp DESC
¢. Select coachname, dataofapp from club order by dateofapp DSC
dd. Select * from club order by dateofapp DSC
An attribute A of datatype varchar(20) has the value “Keshav”. The attribute B of data type
char(20) has value “Meenakshi”. How many characters are occupied in attribute A and
attribute B?
a 20,6
b. 6,20
© 96
d. 69
For Notes, Textbook Solutions, Sample Papers, Practical, Projects, MCQs visit: ww.techtipnow.in
PAC eee406.
407.
408.
409.
410.
au.
412.
413.
“Select Distinct dept_name From emp;” What does this given query do?
a. It gives all the tuples having dept_name
b. It gives the dept_name attribute values of all tuples without repetition
._Itglves all the dept_name attribute of all the tuples
d._ It gives all the dept_name attribute of all the tuples
Suchita is creating a table Employee with fields eno, ename, salary. She doesn’t want the salary
column to be remain unfilled i.e. she wants to make entry in this field mandatory. Which
constraint she should use at the time of creating employee table.
a. Check
b. Default
cc. Not Null
d. Primary Key
‘Chaman want to change the default value of DISCOUNT in the CUSTOMER table from 10 to 15.
Write most appropriate command to do the same.
a. Alter Table Customer Add Discount int default(15);
b. Alter Table Customer Modify Discount int Default(15);
Alter Table Customer Change Discount Default from 10 to 15;
4d. Allof the above
Write a query to display the name of customers whose name contains ‘a’ as third alphabet
from customer table (cno, cname, cadd, mobile).
a, Select cname from customer where cname like %62%a"?
b. Select cname from customer where came like“_ _a’;
¢. Select came from customer where cname like ‘_ _ 2%’;
4d. Select * from customer whete cname like“
Raju is trying to delete all records of table ‘emp’. For this he wrote:
DELETE ALL FROM EMP;
But he is getting error while executing this code. Help him in writing correct code
‘a, DELETE FROM EMP;
b. DELETE * FROM EMP;
DELETE EMP;
d,_DELETE ALL EMP;
“DROP TABLE Customer;”Is a type of statement
a. ODL
be DML
Det
4d. TCL
Which of the following is not DDL command?
a. ALTER
b. SELECT
CREATE TABLE
d. DROP
SQL command used to display the list of tables stored in database
‘a, SELECT TABLES
b. VIEW TABLES
SHOW TABLES
d. LIST TABLES
For Notes, Textbook Solutions, Sample Papers, Practical, Projects, MCQs visit: www.techtipnow.in
PAC eee)414,
41s.
416.
a7.
418.
aig.
420.
421.
422.
Which of the following type of table constraints will prevent the entry of duplicate rows?
2. Unique
b. Distinct
c. Primary Key
dd NULL
The default date format followed in SQ\
a._Dd/mm/yyyy
b. Mm/dd/yyyy
c Yyyy/dd/mm
d. Yyyy/mm/dd
Which of the following is not a valid data type to store alphanumeric data in MySQL?
a char
b. varchar
c. text
d. memo
Which two constraints when applied together will produce a Primary Key constraint?
2. Foreign Key + Unique Key
b. NOT NULL + Foreign Key
NOT NULL + Unique Key
d. Primary Key can not be replaced by combining other constraints
To store Mobile number in a table which data type should be preferred?
a. Int
b. Char(n)
c. Varchar(n)
d. Float
Reena wants to see the the fieldnames and its data type of table ‘department’. What code she
should write?
a. Select * from department;
b. View department;
c. Show table department;
d. Describe department;
Jaikaran want to remove primary key assigned to bookid from book table. Help him in writing
suitable code.
a. Drop primary key from book
b. Alter table book modify bookid drop primary key;
Alter table book drop primary key;
d._ Alter table book drop primary key (bookid);,
Which of the following is not a valid operator used in SQL to set criteria in query?
a. IN
b. LIKE
cc. IS NOT NULL
4.
Write SQL command to display name of all employees containing ‘aa’ as a substring in name.
a, Select name from employee where name like ‘aa%;’
b. Select name from employee where name like “_aa%
. Select name from employee where name like "23%"
d. Select name from employee where name like "_aa_;’
For Notes, Textbook Solutions, Sample Papers, Practical, Projects, MCQs visit: ww.techtipnow.in
73-For Video Tutorials Please visit: www.youtube.com/c/techtipnow423.
42a.
425.
426.
427.
428.
Answers
‘Supriya has following code to insert a record in table ‘salesman’, but getting error. Help her in
writing appropriate code.
INSERT EMP VALUES(‘203',’RAJU’, ‘DELHI’);
‘a, INSERT IN EMP VALUES('203',’RAJU’, ‘DELHI’;
b. INSERT (EMP) VALUES(‘203",’RAJU’, ‘DELHI’
¢._ INSERT TO EMP VALUES(‘203",’RAIU’, ‘DELHI");
d._ INSERT INTO EMP VALUES(‘203" RAJU’, ‘DELHI);
“SELECT * FROM Employee; "is
a. DDL
b. DML
DCL
d. None of these
DDL stands for
a. Dynamic Data Language
b. Database Definition Language
Data Definition Language
d. Dynamic Database Language
DMLis
Database Manipulation Language
b. Data Manipulation Language
¢. Data Maintenance Language
d. Database Maintenance Language
Char(n) and varchar(n) are used to store _
2. Variable, fixed
b. Fixed, variable
Equal, equal
d. None of these
Which of the following provides the ability to query information from the database and insert
tuples into, delete tuples from, and modify tuples in the database?
a, DML(Data Manipulation Language)
b. DDL(Data Definition Language)
© Query
d. Relational Schema
length and variable data
386.c
387.c [388.c_ (389d | 390a [391d | 392b | 393.a | 394.b | 395.b
396.¢
397.2 |398b | 399.a | 400 | 401b | 402 | 403d | 404.b | 405.b
406.b
4o7.c | 408b | 409c | 410.a alta | 412b | 413 | aac | 415d
416.d
ai7c [4i8b [419d 420c | a2id | 422c | 423d | 42ab | 425.c
426.
a27.b | 428.a
For Notes, Textbook Solutions, Sample Papers, Practical, Projects, MCQs visit: ww.techtipnow.in
74-For Video Tutorials Please visit: www.youtube.com/c/techtipnowUNIT —- DATABASE MANAGEMENT
MySQL Functions
429. Which of the following is not multiple row function?
430.
431,
432.
433,
434,
435.
436.
a. Ave()
b, Sumi)
cc sartt)
4d. Both (a) and (b)
SELECT UPPER(SUBSTR(‘Computer System’, 3, 6));
Gives the output as:
a. MPU
b. MPUT
MPUTER
d. PUT
substr( 56434.7812,4,5) gives the output
2. Will produce error
b. No Output
34.78
4.781
Write SQL command to display the name of current month
a, SELECT MONTH(CURDATE());
b. SELECT NAMEOFMONTH(CURDATE();
SELECT MONTHNAME(CURDATE());,
d. Allof the above
WHERE and HAVING clause can be used interchangeably in SELECT query.
a. Yes
b. No
Depends on RDBMS
d. Not Sure
Length() isa
a. Text function
b. (Numeric function
c. Date function
d._ Aggregate function
Consider the string ‘techtipnow’. Wr
a. Select left('techtipnow’,5);
b, Select substr('techtipnow’,1,5);
¢. Select Itrim(‘techtipnow’,5);
d. Both (a) and (b)
Predict the output of
MOD(ROUND(21.8,0),5);
44
2
1
18
SQL command to display first five characters
For Notes, Textbook Solutions, Sample Papers, Practical, Projects, MCQs visit: ww.techtipnow.in
75-For Video Tutorials Please visit: www.youtube.com/c/techtipnow437.
438,
439,
ao.
Write a query to display total no of departments from the given table ‘emp’.
eno _[ename | sal Dept
1 [Ram [3400 _| store
2 [Rakesh [8000 _ | Back office
3__[ Prakash | 6200 _| Back office
4 [Daya [1900 | Operation
5 | Pawan | 3000 | Operation
6 [Abdul | 2800 _| store
7 [simon [4500 [| operation
a, SELECT COUNT(dept) FROM emp;
b. SELECT COUNT(DISTINCT dept) FROM emp;
. SELECT eno, COUNT(dept) FROM emp GROUP BY eno;
d. SELECT dept, COUNT(ename) FROM emp GROUP BY dey
Surendra have been asked to differentiate between WHERE and HAVING clause by his
teacher. He wrote two statements for the same as given below. you have to state
which statement is True and which is False.
(i) Both WHERE and HAVING clause can contain aggregate functions.
WHERE clause can used without GROUP BY clause but HAVING can not.
a. (i) True,(i) False
b. (i) False, (ii) True
. Both are True
d. Both are False
Chunnu has created following table to store the record:
Table : Loan
‘Accno | Accname | Amount | Laontype | Interest
T1021 ‘Sanjeev ‘55000 ‘Auto 7.65
‘TT102 ‘Abhishek | 300000 Home 71
‘T1103 Shagun 12000 Personal 9.85
Tr104 Gunjan 30000 ‘Auto 6.90
TTL05 Jyoti 100000 Home 9.10
He wants to calculate average interest rate of ‘Auto’ type of laon. Help him to do so.
a, select avglinterest) from loan where loantype = ‘auto’;
b. select avglinterest) from loan where loantype in (‘auto’);
c._ Select avglinterest) from loan where loantype = ‘auto’ group by loantype;
d. all of above
For given string ‘techtipnow’ sanjay wants to display the position of ‘p'. what code he should
write to get this?
Select mid('techtipnow’/p');
Select substr('techtipnow’,’p');
Select instr(‘techtipnow,,’p’);
All of the above
For Notes, Textbook Solutions, Sample Papers, Practical, Projects, MCQs visit: www.techtipnow.in
ee ee eee eyaa,
a2,
443,
aaa,
as,
Consider following table ‘item’ and predict the output of following:
Select sum(length(title)) from item where author = ‘Dixit’ Group By Author
No | Title Author Type | DOP aty_| price
1_| Data Structure Dixit Ds 12/10/2003 |4 | 300
2__| Computer Studies French | FND__| 11/11/2003|2 | 75
3__| Advanced Pascal Shildt PROG | 01/12/2003|4 | 350
4_| Dbase Dummies Palmer | DBMS | 23/12/2003 [5 | 130,
5 _| Mastering C+ Dixit PROG | 08/01/2004|3 | 295
6 _| Guide Network Freed NeT | 10/02/2004 3 | 200.
7_| Mastering Foxpro Seigal | DBMS | 17/02/2004 | 20 | 135,
8 | DOS Guide Norton | OS 11/03/2004 |.3__| 475
‘9 _| Basic for beginner Morton | PROG | 21/04/2004 |3 | 40
10 | Mastering C Programs | Dixit PROG | 06/05/2004|1 | 195
a 45
b. 47
a3
4.15
Which of the following is not a single row function?
a. Mod()
b. Ltrim()
c. Year()
d. Max()
Predict the output of ‘Select Round(33792.845,-3);"
a, 34000
b. 33000
cc. 33800
d. 33793
Rahul has created a table book with following columns-
Beode, bname, price, publication
He wants to display lowest price of book publi
Select publication, min(price) from book;
But he did not get the desired result. Help him to get the desired result by rewriting query.
a, Select min(price), publication from book;
b, Select publication, min(price) from book group by publication;
Select publication, min(price) from book having publication
d. All of above
Predict the output of
LENGTH(RTRIM(“ Techtipnow “)); [Note: there are 3 space before and after ‘techtipnow’]
a 2B
b. 10
< 16
a9
wise. He wrote following code
For Notes, Textbook Solutions, Sample Papers, Practical, Projects, MCQs visit: www.techtipnow.in
71 -For Video Tutorials Please visit: www.youtube.com/c/techtipnowa6.
a7.
as.
a9,
Reema att
en ete
Consider the following table Hospital given below and answer next five questions.
No | Name ‘Age_| Department | Deteofadm | Charges | Gender
1 [Suman [56 | Surgery | 21/01/21 [300 | F
2 | Subhash | 65__| ENT 1/12/20 [250 |M
3 [Raheem | 43 | Orthopedic | 19/02/20 [200 |M
4 | Arush 24 | Surgery aa/oi/20_[300_|M
5_| Sarita 32__| ENT 12/01/20 _| 250 EF
6 | Guleshwari [18 | Cardiology | 20/02/20 [800 | F
7 | Kushagra | 28 | Cardiology | 13/01/20 | 800 | M
| Shilpa 24 [ENT 21/02/20 [250 | F
Select appropriate SQL command to display name and department of all the male
candidates with their date of admission in ascending order.
Select name, department from hospital where gender is ‘M’ and order by dateodadm;
Select name, department from hospital where gender = ‘M’ and orderby dateofadm;
Select name, department from hospital where gender ="M! order by dateofadm;
Select name, department from hospital order by dateofadm where gender = ‘VW’;
Jamwant intends to group the result set based on some column’s value. Also, it is required that
the grouped result should appear in sorted order. In which order should the Jamwant write the
‘two clauses (for sorting and grouping) ?
a. Select
From
Order by
Group by
b, Select
From
Group by
Order by
¢. Both (a) and (b) can be taken
d. None of these
Which of the following can be used to display current date?
a. Now)
b. Date()
c, Curdate()
d. Both (a) and (c)
e., All of the above
Name the functions to remove unnecessary leading and trailing space characters comes with
string
a. Left(),right()
b. Lefttrim() righttrim()
cc Ltrim(), rtrim(),
dd. Substr(), instr()
For Notes, Textbook Solutions, Sample Papers, Practical, Projects, MCQs visit: ww.techtipnow.in
PAC eee)oR ee
450. Consider the following table ‘Student’ and predict the output of following query:
Select count(*), count(marks) from Student;
Rollno_ | Name Subject
1 Sanjay Science
2 Ravi Math
3 Gaurav Math
4 Vishal Science
5 Rahul Art
6 Jaishankar _| Science
a 66
b. 65
«56
4.55
451. Forgiven table ‘student’ in Q450, find the output of :
Select max(marks) + Min(marks) from student where subject
a. 134
b. 146
No Output
d. Will generate Error
452. Aryan, a database administrator, has grouped records of a table with the help of group by
clause. He needs to further filter groups of records generated through group by clause. Suggest
suitable clause for it
a, Where Clause
b. Having Clause
Both
d. None of these
453. Which of the following statement is true about ‘Cartesian Product’?
a, It is an operation that combines tuples from two relations regardless of whether they have
the same values or not.
b, The degree of resulting relation is calculated as the product of the degrees of both the
relation under construction.
c. The cardinality of resulting relation is calculated as the sum of the cardinality of relations
under consideration
d. Allare true
454, _ Consider the following tables Product and Customer.
PID PNAME BRAND PRICE
TpOL Telcom powder AK 40
Fw0S, Face Wash ABC 45
B501 Bath soap ABC 55
Sho6 Shampoo XYZ 120
Fw2 Face wash XYZ 95
aD CNAME cy PID
on Cosmetic shop Delhi Fw0S,
2 Total health Mumbai 8501
2 Live life Delhi hos
15 Pretty woman Delhi Fwi2
10 Dreams Chennai Tpo1
apers, Practical, Projects, MCQs visit: www.techtipnow.in
ene eeWrite SQL command to display customername and products name purchased by customer who
lives in Delhi
a, Select cname, pname from customer, product where product.pid = customer.pid having city =
‘delhi
Select chame, pname from customer, product where product.pid = customer.pid and city =
‘delhi’;
. Select cname, pname from customer c, product p where p.pid = c.pid and city = ‘delhi
d. All of above
@, Both (b) and (c)
455. Consider the following tables Employee and Job
Eid Ename Sales Jobid
EL Sanjay lal 1100 102
2 Ravi batra 1200 101
3 Jagbir singh | 1400 103
Ea Mohit mathur | 1250 102
ES ‘Ashish yadav | 1450 108
Jobid Title sal
101 President, 20000
102 Director 16500
103 Manager 12000
104 ‘Accountant | 8000
105 Clerk 6000
Write SQL queries to display name of employee whose salary is lowest.
a. Select ename, min(sal) from employees, job where job jobid = employee.jobid;
b, Select ename, min(sal) from employees, job;
c, Select ename, min(sal) from employee, job having job jobid = employee.jobid;
d. All of the above
456. _Srikant created the following table ‘Student’ in his database; [CBSE IP TERM 2 2022]
Table: Student
Rollno Name Class_| Marks
1 Ritika 2 40
2 Angad 2 35
3 Kaveri 11 a2
4 Durgesh 2 21
5 Denial Fy 4a
6 Rabindra iL 39
7 Rabia il 28
He now wants to count number of student in each class where the number of student is more than
3. He has executed the following query:
Select max(marks) from student where count(*) >3 group by class;
But he got an error. Help him in writing query correctly
Select max(marks) from student group by class having count(*)>
Select max(marks) from student group by class where count(*) >3;
Select count(marks) from student group by class having count(*) >3;
d. Select count(marks) from student group by class where count(*) >3:
For Notes, Textbook Solutions, Sample Papers, Practical, Projects, MCQs visit: ww.techtipnow.in
PAC ee eyRRs
De ee eased
aaa: en ete
457. Predict the output of following cod
SELECT UPPEER(MID( ‘techtipnow computers’,6,10));
a, techtipnow
b. TECHTIPNOW
. ipnow comp
d. IPNOW COMP
458. Which of the following is not a valid join type?
a. Equi join
b. Non equi join
c. Natural join
d. Self join
Answers
az9.c 430. [431.c [432c | 433.b [434.a [435d | 436.b | 437.b | 438.b
439d | aaoc | aa1b [442d | 443.a | aaab | 445a | aa6.c | 4a7.b | 448.0
4ag.c /450.b | 451.b | 452b | 453.a | 454.e |455.a | 456.c | 457.d_ | 458.b
Deere Re ene a
treme eee