So coming on to this Part, I will finally getting on to SQL, which you will realize is a pretty easy language to learn. As Ive said before, SQL - Structured Query Language is a Query Language, used for accessing and manipulation of Databases. So let's manipulate the Database - Student_details that we had made in Part 2. To start working with SQL, here is what you have to do -
Select New Query by Right Clicking on the Table you had created earlier(From Server Explorer). You will get the following popup to select the Table you want to Manipulate. Select the Table required by clicking on Add.
Close the popup, and you will get the following Window. Its divided into 3 sections where you can see Selected Tables, Selected Columns(After executing Query), Result of Queries and the Query you give.
Now you have a place to enter your SQL Queries! So lets begin!
Getting onto the theoretical part and SQL Commands now. SQL Commands are mainly of two types.
- Data Definition Language(DDL) : as the name suggests, it defines a table.
- Data Manipulation Language(DML): again as the name suggests, it is used to manipulate a table.
- SELECT
- UPDATE
- DELETE
- INSERT INTO
You will get the following window, where you can directly type down the values required.
Now get back to the previous window where you give the Query(Right Click on the Table and New Query). This is the general syntax of SELECT command.
SELECT column_name FROM table_name
Lets experiment our First Query, let it be to select all the details(all Columns) from the table. The SQL Query will be like this.
SELECT * FROM student_details
* is a wildcard which selects all Columns. Now to execute it, press ALT+R. Tada! There you get the results in the Window!
That would be enough for this Part!
You learned in this Part
- How to add data into the Table manually
- Two types of SQL Commands - DDL and DML
- SELECT command
- Executing your First SQL Query!
SQL Tutorials






No comments:
Post a Comment