Database queries in SQL are used for different processes in a database management system. Discussed database query types in SQL with examples.
Database queries
Queries are used for database creating, deleting, updating, and data searching, etc. In any database, a lot of data is saved. It is very hard to find data by searching manually. In the database management system by using various queries this process is done.
So, we can say that from a lot of saved data in a database by using a query we find specific data we are finding. Also, many different operations are done by the queries in the database.
Types of database queries
- Select
- Parameter
- Cross tab
- Unmatched
- Action
Select queries
If we do a query basing on a selected field or column then that type of query is called a select query.
Parameter queries
Database parameter queries allow for creating a query that can be modified easily to reflect a new finding term.
Cross tab queries
If we represent the query applied data as a summary or group then there is a type of query is used. That is called the Cross tab query.
Database Unmatched queries
Comparing two tables if we want to find unmatched data then a type of query is used. That is called unmatched.
Database action queries
When using the output of the query data of a table is changed then that is called an action query.
Action queries are 4 types:
- Make table
- Append
- Delete
- Update
Make table query
Suppose we applied a query in a table and find some data. After that from those data if we make another table then we use a type of action query. It is a Make table query.
Append query
If we find some data from a table by a query. After that we add these data into another table then this query s called append query.
Delete query
We use queries for deleting unwanted data from the table.
Update query
An update query is used for updating data from the table.
Database Query language
By using which language queries are applied that is called a query language.
Types of language in database queries
The most commonly used query language in the database are,
- QUEL (Query language)
- QBE (Query by example)
- SQL (Structured query language)
SQL is one of the important query languages from all of these.
Structured query language
Now we are going to discuss Structured query language and their types.
In SQL which we write that is called a statement. It is not case sensitive. That means if we mix uppercase or lower case or together both it will not show an error. After writing a statement in finishing we have to give a semicolon (;) must. We can writhe the statement in a single line or we can also write in multiple lines. But for better understanding, we can write it into multiple lines.
4 types of SQL statement is used.
- Data Manipulation Language(DML)
- Data Definition Language(DDL)
- Data Control Language(DCL)
- Data Transaction Language(DTL)

Data Manipulation Language
By using this we apply these types of operations or database queries.
- SELECT: We find data by using this.
- INSERT: We insert data by using this.
- UPDATE: We can change the data by this.
- DELETE: We delete existing data by this.
Data Definition Language
By using this we apply operations
CREATE: By this, we can create a table, index, or view, etc.
ALTER: By using ALTER we change table, index, or view
DROP: By using drop we remove the table, index, or view
Data Control Language
We control the database by this. We apply the operations given below.
GRANT: If we want to give data accessibility then we use GRANT.
REVOKE: If we want to return the accessibility of data then we use this.
Data Transaction Language
If we want to change data then we use this language. By using this we apply operations given below
COMMIT
If we want to update data and also want to save it permanently then it is used.
ROLLBACK
If we want to get the previous data from updated data then we use ROLLBACK.
SAVEPOINT
If we want to save data update at a specific point then SAVEPOINT is used.
So, from the overall discussion on database queries, we have covered different things.
- What is a Query in a database?
- Types of database queries
- Database Query languages and their types
- Structured query language and its types
0 Comments