Data manipulation language is that part of the language which can be utilised to add or insert the data, delete or modify existing table. With help of data manipulation language we can build on the new data in the table, we can change the data of a records in database and also we can delete the data of a record in table.
Data manipulating language and data control language are actually collecting together as the commands is not been auto committed and it cannot put aside because all the database changes permanently but yet there will be chance which will be pass back.
Data manipulation language is also called as DML which is also explained as computer programming language. Firstly a component of Structured Query Language, which can be used to add, delete or modify data in database. There are four commands in the data manipulation language which are been listed down:
- Select command
- Insert command
- Update command
- Delete command
Select command: this is very salient command in the Structured Query Language which can be pre owned to select the lines of data or information from the record. In simple words we can say that to retrieve or to fetch the information or view set of information.
Lets consider that we want to get the names of the students whose roll number are less than the value 10 then we can use this command to retrieve the names of the students.
This command is pre owned to query the information from the database table and sometimes it is called as the data query language. Syntax of select command will be depending upon our requirement and we use it with the different conditions and clauses so that it will be easy for the users to fetch the data from database
Syntax of this order is been given by as follow:
SELECT * FROM <table name>; |
- This will give the output on all the record which is been present in the table.
- Observe here: one thing which has to be well known in the select command is that if we make use of this, there should be some data which should be present in table of the database which means table should not be empty. If the table is empty, it will give an error to the user on the monitor
- this is used to retrieve the data from the database table which will get back the data in the form of result table and these result tables are called as the result sets.
- In this clause of the select command we will state the columns that we want to output in the query result.
- This section of the first clause and one of the least clauses o statement in the database server evaluates.
- Structured Query Language can be written in any format
- We can get the output more than one column from the tables.
- In SQL statement select and from statement are primary rest are optional
Parameters
- Expressions: we make use of * to select all the columns in the query
- Tables: here we wish to get back the records from and there must be minimum of one table which is been listed within the FROM clause
- WHERE conditions: it has to met for all the records to be selected if no conditions are been provided, then all records will be selected automatically
- Order by: used to sort the records in result set.
Table name: customers
Customer id | Last name | First name |
1000 | Aditya chauhan | Joe |
2000 | Chethan | Alin |
3000 | smith | Derk |
Query 1: write a query which has to display the customer table
SELECT * FROM customer;
Output of query 1:
Customer id | Last name | First name |
1000 | Aditya Chauhan | Joe |
2000 | Chethan | Alin |
3000 | smith | derk |
It will get the output as all columns and row present in the table
Query 2: write a query which has to get output as first name from customer table
SELECT first name FROM customer;
Output of query 2:
First name |
Joe |
Alin |
Derk |
Query 3: write a query which has to get output as customer id and last name
SELECT the customer id, lastname FROM customer;
Output of query 3:
Customer id | Last name |
1000 | Aditya |
2000 | Chethan |
3000 | smith |
Questions
- What is data manipulation language? Explain briefly
- Write example for DML command
- What is order by with example
- What is select command explain briefly