INTRODUCTION TO SQL

SQL i.e. structured query language is used to store the data in databases.
There are two types of database management systems(DBMS)
1) RDBMS (Relational database management system)
2) Non-Relational database management system.

SQL is basically designed for managing the data held in RDBMS. 

In RDBMS the data is stored in specific format especially in tabular form .It has different columns and different rows.
In simple words SQL is specialized computer/programming language that is used to manage the relational databases and perform various operations on that data. 

In order to manage the data SQL has different queries.

1)To create the database 
CREATE DATABASE(<name of database>);

2)To create a table in database

CREATE TABLE STUDENT(student_id INT,Name VARCHAR(20));
here in this query 'STUDENT' is name of the table. student_id and Name are the names of the two columns where INT and VARCHAR  are the datatypes of data in that columns.

                 (This table is just for reference. It is not table which we have created in above query.)

3)To delete the table

DROP STUDENT;
Student table will be deleted.

4)To insert the data into the table

 INSERT INTO STUDENT(student_id,name)VALUES(101,'Prasad');

5)To update or modify the data

UPDATE STUDENT SET student_id=100 WHERE Name='Prasad';

6)To delete the data from table

DELETE FROM STUDENT WHERE Name='Prasad';

7)To search data

SELECT Name FROM STUDENT WHERE student_id=101;
Here the names with student_id=101 will be displayed.

8)To print data in some order or in sorted manner

SELECT Name FROM STUDENT ORDERED BY Name;
This will print all the names in table in ascending order.

Note: All SQL queries are case insensitive. So its our choice to write them in capital or small letters.


These are enough queries as per our project is concerned.


Comments

Post a Comment

Popular posts from this blog

SEARCHING

ORDER BY PART-2

GROUP BY