If you are the student of IT Background, then you must know about the Quarries in DBMS(Data Base Management System). Before that, for learner, the most important and common question is, what are Database languages? If you are the final year student of IT, then this question will be as asked you for several times in the interview or your viva. So, here is the answer : Basically database languages are used to define different databases or to retrieve information from the database through quarries. So, lets go through below commands, which will help you in interview or your viva.
How to write different dml queries in sql :
There are two different types of database languages –
- DDL(Data Definition Language )
- DML(Data Manipulation language)
So, here we will discuss about the DML Language means Data Manipulation language and there are again two types of DML –
A . Procedural :
Procedural, it has to specify what data and how to retrieve data from the table. Eg : C Language
B. Non-Procedural :
Non-Procedural has to specify what data have to retrieve but no procedure is in there to obtain the data. Eg : SQL(Structured Query Language )
Now, Non- procedural DML Languages will be discussed.
SELECT statement :
Most important and most common statement is select. If you want to get the data from the database, then you have to know about the select statement.
Suppose we have a table, namely tbisl ,where all the values are in here, so if you want to view that table, then just follow the query in SQL :
Select * from <table_name>
Eg: select * from tbisl , then you will watch the following output –
II . INSERT statement :
Suppose you want to insert a data into the table, then insert statement is the only option, just follow the query :
Insert into <table_name> values(‘<data>’,’< data >’,’ < data >’, ‘< data >’)
Suppose want to insert data into tbisl tables. Then the query will be-
Eg: insert into tbisl values(‘ELANO BLUMER’,’8’,’3’,’4’)
Output: the isltb table looks like
III. DELETE statement:
Suppose you want to delete data from the data table, then you need to use where clause, but if you want to delete the whole data table then just goes through with this query :
Drop table <tab_name>
Eg : drop table tbisl
And if want to delete for any particular column then
Delete from <tab_name> where <column_name>=’<column_value>’
Eg : suppose I want to delete data from tbisl table where played = 8, then the delete query will be look like :
Delete from tbisl where played=’8’
The table structure looks like –
IV. UPDATE statement :
Suppose, we have missed some data records from a data table, and needs to be update that particular data. In our sample tbisl data tables have all the records and I want to update goal rows of SUNIL CHHETRI. So, again needs to insert where clause for particular columns. The query will be
UPDATE <tab_name> SET <column_name>=<value> WHERE <column_name>=<value>;
Eg : update tbisl set Goal=’7’ where name = ‘SUNIL CHHETRI’;
That’s all. Thanks.
To know what Is CNC Machine, click here.