You are on page 1of 7

DBMS Important Viva Questions Set - 3

Q61. What are Local and Global variables?

Local variables:
These variables can be used or exist only inside the function. These variables are not
used or referred by any other function.

Global variables:
These variables are the variables which can be accessed throughout the program.
Global variables cannot be created whenever that function is called.

Q62. What is Auto Increment in SQL?

Auto increment keyword allows the user to create a unique number to get generated
whenever a new record is inserted into the table.
This keyword is usually required whenever PRIMARY KEY is used.

AUTO INCREMENT keyword can be used in Oracle and IDENTITY keyword can
be used in SQL SERVER.

Q63. What is a Datawarehouse?

Datawarehouse refers to a central repository of data where the data is assembled


from multiple sources of information. Those data are consolidated, transformed and
made available for the mining as well as online processing. Warehouse data also
have a subset of data called Data Marts.

Q64. What are the different authentication modes in SQL Server? How can it
be changed?

Windows mode and Mixed Mode – SQL and Windows. You can go to the below
steps to change authentication mode in SQL Server:

 Click Start> Programs> Microsoft SQL Server and click SQL Enterprise
Manager to run SQL Enterprise Manager from the Microsoft SQL Server
program group.

 Then select the server from the Tools menu.

 Select SQL Server Configuration Properties, and choose the Security page.
Q65. What are STUFF and REPLACE function?

STUFF Function: This function is used to overwrite existing character or inserts a


string into another string. Syntax:
STUFF(string_expression,start, length, replacement_characters)
where,
string_expression: it is the string that will have characters substituted
start: This refers to the starting position
length: It refers to the number of characters in the string which are substituted.
replacement_string: They are the new characters which are injected in the string.

REPLACE function: This function is used to replace the existing characters of all
the occurrences. Syntax:
REPLACE (string_expression, search_string, replacement_string)
Here every search_string in the string_expression will be replaced with the
replacement_string.

Q66. What is Normalization? What number of Normalization shapes are there?


Ans. Standardization is used to compose the information in such a way that
information repetition will never happen in the database and stay away from
embed, refresh and erase irregularities.
There are 5 types of Normalization in SQL –
 First Normal Form (1NF): It expels every single copy segment from the table.
Makes a table for related information and distinguishes one of a kind section
values.
 Second Normal Form (2NF): Follows 1NF and makes and places information
subsets in an individual table and characterizes the connection between tables
utilizing essential key.
 Third Normal Form (3NF): Follows 2NF and evacuates those segments which
don’t relate through the essential key.
 Fourth Normal Form (4NF): Follows 3NF and don’t characterize multi-valued
conditions. 4NF otherwise called BCNF.
Q67. What is Relationship? What number of sorts of Relationship are there?
Ans. The relationship can be characterized as the association between in excess of
one table in the database.
There are 4 kinds –

 One to One Relationship


 Many to One Relationship
 Many to Many Relationship
 One to Many Relationship
Q.68 State a few properties of Relational databases?
 In relational databases, every segment ought to have an extraordinary name.
 Sequences of lines and segments in social databases are unimportant.
 All qualities are atomic and each column is one of a kind.
Q.69 What are Nested Triggers?
Triggers may actualize information adjustment rationale by using INSERT,
UPDATE, and DELETE articulation. These triggers that contain information
adjustment rationale and find different triggers for information change are called
Nested Triggers.

Q.70 What is Cursor?


Ans. A SQL cursor is a database object which is used to control data in a row to
row way.
Cursor takes after strides as given beneath –
 Declare Cursor
 Open Cursor
 Retrieve row from the Cursor
 Process the row
 Close Cursor
 Deallocate Cursor
Q.71 What is Collation?
Ans. In collation, there are a set of principles that are used to check the information.
Q72. What is the distinction amongst DELETE and TRUNCATE?
 The fundamental contrast in both is DELETE is DML summon
and TRUNCATE is DDL.
 DELETE is used to delete a particular column from the table though
TRUNCATE is used to expel all lines from the table.
 We can utilize DELETE with WHERE condition yet can’t utilize TRUNCATE
with it.
Q.73. What is the contrast amongst DROP and TRUNCATE?
TRUNCATE expels all lines from the table which can’t be recovered
back, DROP expels the whole table from the database and it can’t be recovered back.
Q.74. Distinguish between Nested Subquery and Correlated Subquery?
Ans. Subquery inside another Subquery is called as Nested Subquery. On the off
chance that the yield of a subquery is relying upon segment estimations of the parent
inquiry table then the question is called Correlated Subquery.
1. SELECT adminid(SELEC Firstname+' '+Lastname FROM Employee
WHERE
2. empid=emp. adminid)AS EmpAdminId FROM Employee;
This question gets subtle elements of a representative from Employee table.

Q.75. What do you mean by Stored Techniques? How would we use it?
Ans. A stored procedure in SQL is basically statements that are collected that are
used as the function. We can make these put away procedure already before using it
and can execute these them wherever we require and furthermore apply some
contingent rationale to it. Put away systems are additionally used to lessen arrange
movement and enhance the execution.
Syntax:
1. CREATE Technique Technique_Name
2. (
3. /Parameters
4. )
5. AS
6. Start
7. SQL statements in stored methods to refresh/recover records
8. END
Q.76 What do we have to check in Database Testing?
Ans. The following attributes for testing –
 Database Connectivity
 Constraint Check
 Required Application Field and its size
 Data Retrieval and Processing With DML operations
 Stored Procedures
 Functional flow

Q.77 What is SQL Injection?


SQL injection is a code injection technique, used to attack data-driven applications,
in which malicious SQL statements are inserted into an entry field for execution
(e.g. to dump the database contents to the attacker).
SQL injection is a technique used to exploit user data through web page inputs by
injecting SQL commands as statements. Basically, these statements can be used to
manipulate the application's web server by malicious users. SQL injection is a
code injection technique that might destroy your database.
Some common SQL injection examples include: Retrieving hidden data, where you
can modify an SQL query to return additional results. Subverting application logic,
where you can change a query to interfere with the application's logic. UNION
attacks, where you can retrieve data from different database tables.
Q.78 Difference between File System and DBMS

Q79. How to compose an inquiry to demonstrate the points of interest of an


understudy from Students table whose name begins with K?
Ans.
1. SELECT * FROM Student WHERE Student_Name like '%K';
Here ‘like’ administrator is used for design coordinating.
Q.80 What is the language structure to add a record to a table?
Ans. To include a record in a table INSERT language syntax is used.
Ex:
1. INSERT into table_name VALUES (value1, value2..);
Q.81 How to choose all records from the table?
Ans. To choose every one of the records from the table we have to utilize the
accompanying.
Syntax:
1. Select * from table_name;
Q82. How we can refresh the view?
Ans. We can use SQL CREATE and REPLACE for refreshing the view.
Syntax:
1. CREATE OR REPLACE VIEW view_name AS
2. SELECT column_name(s)
3. FROM table_name
4. WHERE condition
Q83. How would you add a section to a table?
Ans. To include another segment in the table, we use AFTER Command.
1. ALTER TABLE table_name ADD (column_name);
5. SQL Interview Questions and Answers for Experienced
Now, let’s see some experience-based SQL Interview Questions and Answers –
Q84. What is Database White Box Testing?
 Database Consistency and ACID properties
 Database triggers and logical views
 Decision Coverage, Condition Coverage, and Statement Coverage
 Database Tables, Data Model, and Database Schema
 Referential integrity rules
Q85. What is Database Black Box Testing?
 Database Black Box Testing includes
 Data Mapping
 Data stored and retrieved
 Use of Black Box techniques such as Equivalence Partitioning and Boundary
Value Analysis (BVA)
Q86. What are Indexes in SQL?
Ans. We use SQL to retrieve the data more quickly.
It declares using CREATE statement.
Syntax:
1. CREATE INDEX index_name
2. ON table_name (column_name)
3. Or
4. CREATE UNIQUE INDEX index_name
5. ON table_name (column_name)

Q87. Is it possible in SQL table to have more than one foreign key?
Ans. Yes, it is possible but it will always have only one primary key.
Q88. Characterize join and name diverse sorts of joins?
Ans. Join is used to get information from related at least two tables. It returns lines
where there is no less than one match in both the tables incorporated into the join.
Read more here.
Kind of joins are:
 Right Join
 External Join
 Full Join
 Cross Join
 Self Join.
Q89. Explain SQL Delete command.
Delete is used to erase a column or lines from a table in light of the predetermined
condition.
The language SYNTAX is as per the following:
1. DELETE FROM table_name
2. WHERE <Condition>

You might also like