DBMS Viva Questions
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
6) 1 python program
9) What is .commit()
15)SQL queries
16)python program....there were two more questions that I don't quite remember
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
24) difference in primary key and foreign key with respect to null values
25) how many foreign keys can have null values
28) 3 queries - 2 were simple, third one wasn’t super hard ig but I couldn’t figure it out
32) Which topics are you comfortale with? I said I am ok with the basics, not yet well-versed with
advanced topics.
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).
46)Queries:
I LIS
II. University
Number of students studied in each building during 2005 and 2008, including those years
2 Programming:
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
52)Null
55)Show all the table in the dataset and Explain every table in one line,
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,
65). Some question in flask which I did not recollect (didn't answer)
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)
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.
88)Show all the table in the dataset and Explain every table in one line,
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,
102)one python Q
103)told to print match details in this format using python from flis
106)Coding problems:
107). Find the name of the managers who have joined between 2019 & 2020.
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,
3)Practice DDL n DML queries and python connection using psycopg2.. And be confident
import psycopg2
con=psycopg2.connect(database='lisdb',user='postgres',password='1234')
with con:
cur = con.cursor()
while True:
rows = cur.fetchall()
print(row[2])