SQL interview Questions Flashcards
(15 cards)
What is the difference between delete and truncate statements?
DELETE : Deletes a ROW within a table
DML
You CAN bring back data
SLOWER
TRUNCATE: Deletes ALL ROWS from table
DDL
You CANNOT bring back data
FASTER
What are the different subsets of SQL
DDL, DML, DCL, TCL
What do you mean by DBMS (Database Management Systems)? What are the different types?
- A DBMS is basically a data keeping system. The data can stored in these DBMSs can be modified, retrieved, & deleted.
- There are four types of DBMSs
- Hierarchal
- Object Oriented
- Network
- Relational
What do you mean by a table and field in SQL?
Table: A collection of data that is organized in BOTH rows & columns
Field: refers to the number of columns within a table
What are JOINS in SQL?
A Join clause is used to combine rows from two or more tables based on a related column between them.
Four types of Joins:
* Inner Join
* Full Join
* Left Join
* Right Join
What is the difference between CHAR & VARCHAR in SQL?
CHAR = fixed length (only 10 characters)
VARCHAR = variable length
What is a Primary Key?
It is usually the unique identifier within a relational database
What are Constraints?
Constraints are usually used to specify the limits of the data
5 Constraints are:
- Not Null
- Unique
- Check
- Default
- Index
What is the difference between SQL & MySQL?
SQL is the standard language and is also the core of relational database while MySQL is open source and provides multi-user access
What is a Unique Key?
It’s the set of field or columns that helps us uniquely identify records.
What is a foreign key?
Foreign key is a constraint that links a column to another column from another table through the primary key.
What do you mean by data integrity?
Data integrity refers to the accuracy and consistency of data stored in a database
What is the difference between clustered & non-clustered index in SQL?
Clustered index is much faster & alters the way records are stored. You can only have ONE clustered index.
Non - clustered is much slower & does not alter the way data is stored. You can have MANY non-clustered indexes.
Write a SQL query to display the current date:
Select GetDate ();
What do you mean by denormalization?
Denormalization is a technique used to access data from higher to lower forms of a database