Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Tuesday, March 19, 2013

3 : SQL Statements

SQ can be divided into 2 parts.

1 : DML (Data Manipulation Language)

  • SELECT
  • UPDATE
  • DELETE
  • INSERT INTO

2 : DDL (Data Definition Language)

  • CREATE DATABASE
  • ALTER DATABASE
  • CREATE TABLE
  • ALTER TABLE
  • DROP TABLE
  • CREATE INDEX
  • DROP INDEX
Now we are going to learn a little bit about all the Queries used in SQL , with Example.

Thursday, March 7, 2013

2 : SQL-create Database & Table

Read SQL - Some Examples before proceeding..
==============================================
When we open SQL ( I am using SQL server-2005) , we can see a screen as




Here,

  • Server name is the name we are giving at the time of SQL Installation.
  • Authentication : 2 types of Authentications are there namely , (a) Windows Authentication and (b) SQL Server Authentication . Window Authentication doesn't require user name and password , hence  a little secure. But on the other hand , SQL Server Authentication requires user name and password. Here sa is the default user name and password  we can set. 
Click Connect .

Then the home screen will open as ;


(A) How to create a Database ?



  • You can see the option Databases.
  • Right click on Database , then we can see a drop down menubelow it. , and click New Database.
  • Then we can see a screen as ;



  • Give the Data base name .Here I am giving Registraion , then click OK.
  • Now we will return to the previous screen. Click on the + symbol to enlarge the options(or double click on it) and we can see some other options formed below it, with the database name Registration.


(B) How to create Tables ?

Now we creating Tables for the database Registration .
Double click the database Registration or ( click on the + symbol to enlarge) , and some other options below it. Select Table from that list ;


Now , as told before,right click on that Table , and select New Table from the drop down menu , to create a new table .
Now we can see an option with Column name & Data type to create a table.



Suppose , we want to enter the registration details , with column names as id, first name , last name , age , address and email id , we can set the fields like this .



As we enter the fields, we can see there is a number of Data types also be there . Choose them as per the column name .
Note that , below that , we can see the column properties also.

Some fields like ID of a person should not repeat , and we can thus set it as Primary Key. When we set a primary key , that field will not repeat. That means  , two persons cannot have same ID.

How to set Primary Key ?

Select the field in which we want to set the primary key.
We can see an arrow there , and right click on that arrow .Then we can see a drop down menu , and from that drop down menu , select Set Primary Key . Now we can see  LOCK symbol , which implies, "that id is set to as primary key and will never repeat for another field ".

See the figure below :


Hope you understand , how to create a Database and Table.

Back to SQL .
NEXT CHAPTER                                                                    
 PREVIOUS CHAPTER

1 : SQL - Some Examples

What is SQL?

SQL is a standard language for accessing databases.

RDBMS is the basis for SQL, and for all modern database systems (Refer the link
Introduction to DBMS / RDBMS )
  • SQL stands for Structured Query Language
  • SQL lets you access and manipulate databases
  • SQL is an ANSI (American National Standards Institute) standard

without SQL or any other knid of Databases, we can't store informations.

At first , click these links to know about different SQL connectivity programs ...

These are all for your references.

Now we are going to understand a little bit about SQL.

Return to SQL