0% found this document useful (0 votes)
108 views

DBMS Viva Questions

This document contains a list of questions asked in a DBMS viva or interview. It includes questions on database concepts like relationships between tables, DDL and DML, data types, constraints, joins, indexes and more. It also provides Python programs and SQL queries that were asked. At the end, it lists some advice for the viva like practicing DDL, DML, queries and Python database connectivity.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views

DBMS Viva Questions

This document contains a list of questions asked in a DBMS viva or interview. It includes questions on database concepts like relationships between tables, DDL and DML, data types, constraints, joins, indexes and more. It also provides Python programs and SQL queries that were asked. At the end, it lists some advice for the viva like practicing DDL, DML, queries and Python database connectivity.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

DBMS Viva Questions

1)He selected 2 tables and asked me what is the relationship between these 2 (one to one/ one to
many,etc)

2)What kind of exception can be handled using try except block in python while connecting with
database

3).DDL&DML explain

4).Difference b/w Delete,drop,truncate(which of these is ddl/DML)

5). Three medium level queries

6) 1 python program

7)flask, what's that?

8) .connect() & rollback() what's the difference & purpose of them

9) What is .commit()

10).default host& port no. In flask?

11).what is check constraint

12).difference between drop, truncate and delete

13).difference between fetchone fetchmany and fetchall

14.)steps to perform query from python

15)SQL queries

16)python program....there were two more questions that I don't quite remember

17) full form of SQL

18) what does the structured in SQL stand for

19) does unstructured data exist ? How do we manipulate that ?

20) full form of NoSQL

21) using psql, retrieve the column names and data types for a given table

22) what are the different data types present - asked about varchar

23) what is the significance of the null value

24) difference in primary key and foreign key with respect to null values
25) how many foreign keys can have null values

26) what is the sum of an integer and a null value

27) use of null values in a database

28) 3 queries - 2 were simple, third one wasn’t super hard ig but I couldn’t figure it out

29) easy python code

30) explain exception handling in the python program

31) what is natural join

32) Which topics are you comfortale with? I said I am ok with the basics, not yet well-versed with
advanced topics.

33). What is normalization? Why do we normalize databases?

34) What is dependency preservation? Is it necessary?

35) He asked about weak and strong entity sets through examples (employee and dependents example)
and how they are represented in ER diagram.

36) What are the choices of primary keys for 'employee' and 'dependent' relations and why?

37) SQL queries - 2. The second one he asked to write using joins (shared below).

38) Python connection using psycopg2 - Find the names of all the instructors from university database
whose salary is a prime number (shared below).

39) DDL & DML difference and what are they

40)Delete & Truncate difference

45)What are triggers and any real life examples

46)Queries:

I LIS

Name of author whose first name has a single letter

II. University

Number of students studied in each building during 2005 and 2008, including those years

Name of the department where 'Gita Das' studies

2 Programming:

Write a code to display student names as

Mr. (Followed by first letter of first name) (then last name) if gender is Male, else Ms. Followed by name
in same format
47)New stuff to read so far DBMS viva

48)Truncate

49)Check constraint

50)Fetchall fetchmany

51)Retrieving table/schema details

52)Null

53)) Proctor ask me to use CMD,

54)ask me to choose a dataset of my choice,

55)Show all the table in the dataset and Explain every table in one line,

56)Show top 5 row of any table,

57)create a table in that database with some attributes,

58)Why Constraint are used?

59)What are different types of data type?

60)Difference between integer and varchar,

61)Explain inner Join, outer Join, left join and right join.

62)Show any table in cmd which have primary key as well as foreign key. Explain with example.

63)Write a program to insert into the table that you have created and show the output in the cmd,

64). What are triggers

65). Some question in flask which I did not recollect (didn't answer)

66). What is Self Join - give an instance

67) simple SQL queries

68) query on connecting from python to database.

69)What is the difference between an exception and an error

70) What is try, except

71). What is a nested query

72). Within a nested query, is it the inner query or the outer query that gets executed first? (Answer
inner query)
73). Is python a compiler, an interpreter or a declarative language (it's an interpreter - SQL is a
declarative language)

74). There is a program in which division operation is a must for the program to proceed - How do you
ensure that the program continues running even if the divisor is 0.

75)I tried answering based on try and except and I was saying just skip the operation whenever we get a
zero division error

Answer: Since the constraint was that the division 'had to happen', we will divide it by a number very
close to 0 whenever the divisor is zero. (This was a bar raiser question since I was stuffing up the query
questions too :D)

76)Difference between natural join and inner join

77) Delete, truncate, drop- differences

78) What is commit and rollback?

79). What is a view, can we do updation, deletion,etc. in it? Why do we use it?

80) simple queries, fourth one was a 'join' problem and it took me quite some time.

81)Python program also was a very complex join and I couldn't finish it on time :(

82) write a query to display first name and last name of author whose first name consist of minimum 5
characters and ends with M.

83)write a query to to perform inner join between student and department in University database and
sort output on any column in descending order.

84)write a query to to find out number of students who have studied in each building from university
database.

85)write a program to find the name of book whose ISBN number is a perfect square and does not start
with VOWELS.

86)Proctor ask me to use CMD,

87)ask me to choose a dataset of my choice,

88)Show all the table in the dataset and Explain every table in one line,

89)Show top 5 row of any table,

90)create a table in that database with some attributes,

91)Why Constraint are used?

92)What are different types of data type?

93)Difference between integer and varchar,

94)Explain inner Join, outer Join, left join and right join.
95)Show any table in cmd which have primary key as well as foreign key. Explain with example.

96)Write a program to insert into the table that you have created and show the output in the cmd,

97)DDL, DML difference

98)natural join, inner join difference

99)Sub query and something I forgot difference (something related to week 3)

100)query question related to graded, practice queries

101)one query Q using except

102)one python Q

103)told to print match details in this format using python from flis

[match_date] : [host_team_name]-[host_team_score] : [guest_team_name]-[guest_team_score]

and this in descending order with respect to match_date

: select match_date, name as host_team,host_team_score,guest_team_score from matches,teams


where team_id=host_team_id order by match_date DESC;

104) What is primary index & secondary index

105). Can secondary key have duplicates

106)Coding problems:

107). Find the name of the managers who have joined between 2019 & 2020.

108). Oldest player name in the team 'All Stars'

109). Use python code to write student name in the format Mr. Student_fname Student_Lname OR Ms.
Student_fname, Student_lname depending on gender.

110) Find the names and date-of-births of those managers who have joined in years 2019 and 2020.
(Database: FLIS)

111) Write a SQL statement to find the names of players that start with ‘ S’ but does not end with ‘ n’

112) Write a SQL statement to find out the managers date of birth(dob) of the team for which“Shlok”
plays. (Database: FLIS)

113) Find the names of the fourth referees (fourth_referee) and the match number of all matches
played on “2020-05-19”. (Database: FLIS)

114) Write a program to find the names of those books whose ISBN number is an even number and
whose name does not start with a vowel.
Advises for Viva

1)Connect to a database,

Make a cursor,

Execute queries,

Save result,

Commit/rollback changes,

Disconnect database.

2)Based on feedback from those who went first in this squid game,

Just read weeks 2, 3 and 7..

3)Practice DDL n DML queries and python connection using psycopg2.. And be confident

4)Keep the format to connect with database using python ready

import psycopg2

con=psycopg2.connect(database='lisdb',user='postgres',password='1234')

with con:

cur = con.cursor()

cur.execute('select student_fname,student_lname, gender from students')

while True:

rows = cur.fetchall()

for row in rows:

print(row[2])

You might also like