SQL Technical Interview Questions

What is SQL?

SQL stands for Structured Query Language. It is primarily used to communicate with a database. Specifically, a domain-specific language that is used in programming and designed for managing data held in a relational database management system (RDBMS). It is also used for stream processing in a relational data stream management system (RDSMS).

SQL can be used to modify database tables and index structures, as well as for adding, updating and deleting rows of data. It can also be used for retrieving subsets of information from within a database for transaction processing and analytics applications.

Since the 1970s and 1980s, SQL has become the standard programming language for relational databases.

What is a Database?

A database is nothing more than a base for data. Basically, it is a collection of data. A database is designed as such so that the data in it can be easily accessed, managed, organized, and updated. It is a system that is designed for organization and to make data management easier.

A database can be of many types depending on the type of content, such as bibliographic, full-text, numeric, and images. Or even according to their organizational approach. For example: a relational database that is a type of  tabular database in which the data is defined in such a way so that it can be reorganized and accessed in a number of different ways.

When did SQL appear?

SQL is a type of database language that is primarily used for managing a database. It can be used to create a database, delete it, fetch rows or modify them, and so much more.

SQL first appeared on the scene in 1974. Since then, it has gone on to become the standard programming language for relational databases.

What are the usages of SQL?

SQL has become the standard database language for use with databases. It can be used for the following tasks:

  • To create new databases
  • To execute queries against a database
  • To retrieve data from a database
  • To inserts records in a database
  • To updates records in a database
  • To delete records from a database
  • To create new tables in a database
  • To create views in a database
  • To delete databases
Does SQL support programming?

No, SQL does not support programming. This is primarily because it does not have a loop or Conditional statement. SQL is primarily used like a commanding language to access and modify databases.

What are the subsets of SQL?

SQL has three subsets. Each one serves a different purpose. They are as follows:

  • Data definition language (DDL) – can be used to manage table and index structure
  • Data manipulation language (DML) – can be used to add, update and delete data
  • Data control language (DCL) – can be used to authorize users to access and manipulate data
What is data definition language?

Data definition language (DDL) is a type of a computer language. Technically, it is a syntax similar to a computer programming language for defining data structures. It is primarily used to define the different structures in a database, including views, schemas, tables, indexes, etc.

DDL statements can be used to create, modify, and remove database objects such as tables, indexes, and users. Some of the common DDL statements are CREATE, ALTER, and DROP.

Data definition language is also known as data description language is some instances as it describes the fields and records in a database table.

What is data manipulation language?

Data manipulation language (DML) is a family of syntax elements that users can use to manipulate data in a database. It is similar to computer programming language.

DML is primarily used for selecting, inserting, deleting and updating data in a database. DML is also at times used to perform read-only queries of data.

A popular example of DML is SQL, which can be used to retrieve and manipulate data in a relational database. Some other forms of DML are those used by IMS/DLI, CODASYL databases, such as IDMS and others.

What is data control language?

Data control language (DCL) is a type of syntax that is similar to a computer programming language. It is primarily used to control access to data stored in a database. It is a component of SQL.

DCL is primarily used to control privilege in a Database. It defines the tasks that a user is allowed to perform, such as creating tables, sequences or views. Privileges can be of two types: System Privileges: allow the creating of a session, table, etc.; and Object Privileges: any command or query that work on tables.

DCL is used in collaboration with Data definition language (DDL) and the Data manipulation language (DML). It may include CONNECT, SELECT, INSERT, UPDATE, DELETE, EXECUTE, and USAGE.

Two common examples of DCL include GRANT which allows specified users to perform specified tasks, and REVOKE which cancels previously granted or denied permissions.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.