Download SQL Interview Questions & Answers 2018 | Mindmajix PDF

TitleSQL Interview Questions & Answers 2018 | Mindmajix
TagsPl/Sql Sql Oracle Database Databases Relational Database
File Size245.3 KB
Total Pages30
Document Text Contents
Page 1

The Best SQL Interview Questions & Answers 2018

Q. What is SQL?

SQL (​Structured Query Language​), It is also pronounced as “SEQUEL” and it an Non-procedural

Language which is used to operate all relational database. And it is used to communicate with the

Database. This is a standard language used to perform tasks such as retrieval, updation, insertion

and deletion of data from a database.

Features of SQL:

1. Portability

2. Client server architecture,

3. Dynamic data definition,

4. Multiple views of data,

5. Complete database language,

6. Interactive,

7. High level,

8. Structure and SQL standards.

Q. Difference between SQl & MYSQL.

SQL MYSQL
SQL stands for Structured Query
Language

MySQL is a RDMS (Relational Database Management
System)

Allow for accessing and manipulating
db's

MySQL is a database management system, like SQL
Server, Oracle, Postgres, Informix etc

Basically works as the prompter to a
DBMS

It Facilitates multi-user access to a huge number of DBs

SQL codes & commands are used in
various DBMS and RDBMS systems
such as MySQL.

MySQL has SQL at its core, and requires future upgrades
mostly

Visit For More Info:: https://mindmajix.com


https://mindmajix.com/how-to-create-shared-query-in-sql-server
https://mindmajix.com/

Page 2

Q. What is SQL Server?

SQL Server is ​Microsoft's relational database management system (RDBMS). End user cannot

interact directly with database server. If we want to interact with ​SQL database server then we have

to interact with SQL.  1

Q.SQL Servers Versions:

SQL Server Code Name
SQL Server 2017 vNext
SQL Server 2016 Helsinki
SQL Server 2012 Denali
SQL Server 2008 R2 Kilimanjaro
SQL Server 2008 Katmai
SQL Server 2005 Yukon
SQL Server 2000 Shiloh
SQL Server 7.0 Sphinx

Q. What are the different types of SQL’s statements?

1​. ​DQL ​- Data Query Language ( or) Data Retrival Language

● SELECT ​Statement

2​. ​DML ​– Data Manipulation Language

DML is used for manipulation of the data itself.

● INSERT ​Statement
● UPDATE ​Statement
● DELETE ​Statement

3​. ​DDL ​– Data Definition Language

DDL is used to define the structure that holds the data.

● CREATE ​Statement
● ALTER ​Statement
● DROP ​Statement
● RENAME ​Statement

1

Visit For More Info:: https://mindmajix.com


https://mindmajix.com/sql-server
https://mindmajix.com/sql-server/what-is-hdinsight-sql-server
https://mindmajix.com/sql-server/introduction-to-sql-server-database-backup-and-restore
https://mindmajix.com/whats-new-in-sql-server-2016
https://mindmajix.com/

Page 15

Q. ​Difference Between SQL and PL/SQL?

SQL PL/SQL
It’s complete name is structured query
language

It’s complete name is procedural
Language / Structured Query
Language

It doesn’t have the any facility of
branching or looping

It has the complete facility of
branching or looping

In SQL, only one statement can be
sent to Oracle Engine. It increase the
execution time

In PL/SQL, a complete block of
statements can be sent to Oracle
engine at a time, reducing traffic

In SQL, the use of variables is not
possible

In PL/SQL, the results of the
statements can be stored in
variables and can be used further as
per the requirement

It doesn’t have the capacity for
procedural language

It is fully support procedural
language

In SQL, there is no facility of error
management. In case of error
condition, It is the Oracle Engine that
tracks it.

In PL/SQL, the results of the
statements can be stored in
variables and can be used further as
per the requirement

Q. What is the Difference Between SQL & MYSQL?

SQL is more natural than MYSQL. MySQL is a computer application. whose DBMS allows multiple

users. It enables access to several database application and management system. SQL is more

natural and standard language that is used with different applications alike. But, however no

organization actually employs this standard language, rather every software firm follows its own kind

of SQL version.

Q. What is the Temporary Tables?

Syntax​: CREATE TABLE #TempTab()

A Temporary Table or Temp-Table is created on disk in the tempDB system database. The name of

this Temp-Table is suffixed with a session-specific ID so that it can be differentiated with other

similar named tables created in other sessions. The name is limited 116 chars.

Visit For More Info:: https://mindmajix.com


https://mindmajix.com/

Page 16

Example:

Here is an example showing you the usage of a temporary table.

mysql> CREATE TEMPORARY TABLE SALESSUMMARY (

-> product_name VARCHAR(50) NOT NULL

-> , total_sales DECIMAL(12,2) NOT NULL DEFAULT 0.00

-> , avg_unit_price DECIMAL(7,2) NOT NULL DEFAULT 0.00

-> , total_units_sold INT UNSIGNED NOT NULL DEFAULT 0

);

Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO SALESSUMMARY

-> (product_name, total_sales, avg_unit_price, total_units_sold)

-> VALUES

-> ('cucumber', 100.25, 90, 2);

mysql> SELECT * FROM SALESSUMMARY;

+--------------+-------------+----------------+------------------+

| product_name | total_sales | avg_unit_price | total_units_sold |

+--------------+-------------+----------------+------------------+

| cucumber | 100.25 | 90.00 | 2 |

+--------------+-------------+----------------+------------------+

1 row in set (0.00 sec)





Visit For More Info:: https://mindmajix.com


https://mindmajix.com/

Page 29

Q. What is Autoincrement?

In all databases generating primary key value automatically is called auto increment concept. In

Oracle we are implementing auto increment concept by using row level triggers, sequences. i.e here

we creating sequence in sql and use this sequence in PL/SQL row level trigger.

SQL> create table test (sno number(10), primary key, name varchar2(10));

Q. What is Dynamic SQL?

It is the combination of SQL, PL/SQL i.e SQL statements are executed dynamically with PL/SQL

block using execute immediate clause.

Generally in PL/SQL block we are not allow to use DDL, DCL statements using Dynamic SQL DDL,

DCL statement within PL/SQL block.

Syntax:

begin
execute immediate ‘sql statement’
end;
/

Q. Write a dynamic SQL program to display number of records from emp table?

SQL​> declare
z number(10);
begin
execute immediate ‘select count * FROM emp’
into z;
dbms_output.put_line(z);
end;
/

Q. Write a dynamic SQL program for passing department number 20 retrieve deptnames, Loc

from dept table?

SQL​> declare
v_deptno number(10):=20;
v_dname varchar2(10);
v_loc varchar2(10);
begin

Visit For More Info:: https://mindmajix.com


https://mindmajix.com/

Page 30

execute immediate ‘select dname, loc FROM dept where deptno=1’ into v_dname, v_loc using
v_deptno;
dbms_output.put_line(v_dname ||’ ‘|| v_loc);
end;
/

List of Related Microsoft Certification Courses:

​SSIS ​Power BI
​SSAS ​SharePoint
​SSRS ​SQL Server DBA
​SCCM ​BizTalk Server
​Team Foundation Server ​BizTalk Server Administrator







Visit For More Info:: https://mindmajix.com


https://mindmajix.com/ssis-training
https://mindmajix.com/power-bi-training
https://mindmajix.com/ssas-training
https://mindmajix.com/sharepoint-training
https://mindmajix.com/ssrs-training
https://mindmajix.com/sql-server-dba-training
https://mindmajix.com/sccm-training
https://mindmajix.com/biztalk-server-training
https://mindmajix.com/tfs-training
https://mindmajix.com/biztalk-server-administrator-training
https://mindmajix.com/

Similer Documents