SQL Interview Questions
SQL Interview Questions
Here we see database related interview questions which are very very imp for a p
erson who attent a microsoft related interview
What is sql
SQL is a standard computer language for accessing and manipulating database syst
ems.
SQL statements are used to retrieve and update data in a database. SQL works wit
h database programs like MS Access, DB2, Informix, MS SQL Server, Oracle, Sybase
, and other database systems.
What is ado
ADO is a programming interface to access data in a database from a web site.
ADO uses SQL to query data in a database.
Can you be precise about sql and What can u do with sql
· SQL stands for Structured Query Language
· SQL allows you to access a database
· SQL is an ANSI standard computer language
· SQL can execute queries against a database
· SQL can retrieve data from a database
· SQL can insert new records in a database
· SQL can delete records from a database
· SQL can update records in a database
Do u know any commands in sql if so tell about them
· SELECT - extracts data from a database table
· UPDATE - updates data in a database table
· DELETE - deletes data from a database table
· INSERT INTO - inserts new data into a database table
Tell some thing about ddl
The Data Definition Language (DDL) part of SQL permits database tables to be cre
ated or deleted. We can also define indexes (keys), specify links between tables
, and impose constraints between database tables.
Tell some basic ddl statements
· CREATE TABLE - creates a new database table
· ALTER TABLE - alters (changes) a database table
· DROP TABLE - deletes a database table
· CREATE INDEX - creates an index (search key)
· DROP INDEX - deletes an index
What do u know about result set
The result from a SQL query is stored in a result-set
Where we use distinct statement
The DISTINCT keyword is used to return only distinct (different) values.
Tell some thing about aliases
With SQL, aliases can be used for column names and table names
Tell syntaxes for column name aliases and table name aliases
SELECT column AS column_alias FROM table
SELECT column FROM table AS table_alias
What do u know about primary key
A primary key is a column with a unique value for each row. Each primary key val
ue must be unique within the table. The purpose is to bind data together, across
tables, without repeating all of the data in every table.
Where exactly u use joins?
we can select data from two tables with the JOIN keyword
what does inner join do?
The INNER JOIN returns all rows from both tables where there is a match.
Do u know any thing about union?
The UNION command is used to select related information from two tables, much li
ke the JOIN command. However, when using the UNION command all selected columns
need to be of the same data type.
What is union all command
The UNION ALL command is equal to the UNION command, except that UNION ALL selec
ts all values.
Tell some thing about drop index
You can delete an existing index in a table with the DROP INDEX statement.
What does truncate do?
deletes only the data inside the table
what does alter table do?
The ALTER TABLE statement is used to add or drop columns in an existing table.
How do we use fuctions in sql
SELECT function(column) FROM table
Write syntax for group by
SELECT column,SUM(column) FROM table GROUP BY column
What do u know about view
In SQL, a VIEW is a virtual table based on the result-set of a SELECT statement.
A view contains rows and columns, just like a real table. The fields in a view a
re fields from one or more real tables in the database. You can add SQL function
s, WHERE, and JOIN statements to a view and present the data as if the data were
coming from a single table.
Tell me what u know about dbms
A Database Management System (DBMS) is a computer program that can access data i
n a database.
The DBMS program enables you to extract, modify, or store information in a datab
ase.
Different DBMS programs provides different functions for querying data, reportin
g data, and modifying data.
Tell me what u know about Rdbms
A Relational Database Management System (RDBMS) is a Database Management System
(DBMS) where the database is organized and accessed according to the relationshi
ps between data.
RDBMS is the basis for SQL, and for all modern database systems like Oracle, SQL
Server, IBM DB2, Sybase, MySQL, and Microsoft Access.