Computersight > Programming

SQL and Databases

The basics of SQL, such as creating a new table, inserting a new record, modifying an existing record, deleting a record, and showcasing a particular record.

SQ

SQL can be expanded as Structured Query Language. It is used to create, manipulate and delete data in a database. This language facilitates very easy database interactions. SQL statements are simple and easy to execute.

Query

Query is a statement which is used to manipulate data available in a database, granting users roles and permissions, creating new databases, creating new tables, deleting table values etc.

Creating New Tables

Using a single statement we can able to create a new table. The following query when executed creates a new table.

Syntax

Create table TABLE_NAME (VARIABLES)

Example

Create table employee (name VARCHAR (20), num NUMBER (5))

The above query creates employee table with name and num fields. It has the ability to store number of names with their employee numbers.

Inserting Values to New Table

Insert statement is used to insert a new record into the table. The Insert statement has the following syntax.

Syntax

Insert into TABLE_NAME (VALUES)

Example

Insert into employee ('xxx', 30)

Modifying Values in a Table

We can able to modify the values available in a table by using the update query. The update query has the following syntax.

Syntax

Update TABLE_NAME set VARIABLE = VALUE where CONDITION

Example

Update employee set name='xyz' where num=30

Selecting a Particular Record

A particular record can be fetched from the table. It can be evaluated by using the select query.

Syntax

Select VARIABLES from TABLE_NAME

Example

Select name, num from employee where num=30

The above query when executed checks the database for num=30 if the condition is satisfied then the particular query will be fetched from the table.

Deleting a Record from the Table

A particular record can be deleted from the table using the following query. Using the delete statement we can able to delete a single record or a group of record having a same attribute.

Syntax

Delete from TABLE_NAME where CONDITION

Example

Delete from employee where num=30

This article describes the basic SQL operations such as creating a table, selecting values from the table, inserting a new record, modifying an existing record, deleting a record. All these queries form the basis for the database operations.

3
Liked It
I Like It!
Related Articles
Sometimes, N-tiered Application Development is a Lot Like What I Had for Lunch  |  Microsoft Access Database 1: What is a Database
More Articles by R Rajesh
Basic Storage Terminologies  |  Operating System: The Soul for Hardware's
Latest Articles in Programming
Microsoft Sql Server 2005: An Easy Task  |  Why Solidworks?
Comments (0)
Post Your Comment:
Name:  
Copy the code into this box:  
Post comment with your Triond credentials?
Inside Computersight

Communication & Networks

 /

Computers

 /

Hardware

 /

Operating Systems

 /

Programming

 /

Software


Popular Tags
Popular Writers
Powered by
Computersight
About Us
Terms of Use
Privacy Policy
Services
Submit an Article
Advertise with Us
Contact

© 2007 Copyright Stanza Ltd. All Rights Reserved.