This Question Is Answered:
 How can I write SQL queries?
 01 Feb 2007 12:07
 Flag
 Before knowing how to write queries in SQL it is important to know what the different types of SQL queries that you can write are. The following are the four main categories of SQL queries:

• DRL (Data Retrieval Language)
• DML ( Data Manipulation Language)
• DDL ( Data Definition Language)
• DCL (Data Controlling Language)

There names are just given only for categorization so that you may have a better understanding of SQL queries. DRL contain the queries that are used to retrieve or fetch data from the database, such as SELECT statement. You can fetch data from table in accordance to your requirement. DML means the queries that can manipulate the data such as UPDATE, DELETE and INSERT. Likewise DDL means the queries that help in creating and defining the data object such as Tables, Views, Synonyms and Indexes and these queries include CREATE, ALTER. Whereas DCL contain the queries that are used to create new users and for controlling their access to database. Here is an example of SQL queries:

DRL

SELECT FROM EMP
WHERE EMPNO=7788;

DML

UPDATE EMP
SET SAL=2000
WHERE ENAME=’KING’;

DELET FROM DEPT
WHERE LOC=’DALLAS’;

DDL

CREATE TABLE EMP
(EMPNO NUMBER (4), ENAME VARCHAR2(10), JOB VARCHAR2(20));

DCL

CREATE USER SCOTT
IDENTIFIED BY TIGER;
Unrated

1 ratings
by   toshi76
  03 Apr 2007 04:43
 Flag

1000 words left

    


 SQL is a programing language designed specifically to add, delete, update information in a relational database. The databse you are using will usually offer several methods of creating a query. a common one is called query by example where you simply select from a graphical display the tables and fields that you wish to be returned, and the program writes the SQL for you. You can often access a code version of the query and see the SQL it has created. To edit this, simply type in the changes you wish to make.

But power users of databases often simpy write the SQL by hand and save it to a file. They can use either a command line interface where they type in the SQL, or a simple text editor and then cut and paste the code into the database. The text editor option is very much better, as you can save your first attempt and if it goes wrong simply edit it and try again. The command line way can be frustrating as editing it is trickier. Also when using a sub-query, you can create the query in steps and then cut and paste the working parts together in the editor much more safely than trying to re-type the whole thing by hand at the command line.
Unrated

2 ratings
by   drjohn
  01 Feb 2007 12:50
 Flag

1000 words left

    


Blurtit Tools:  Email to a Friend    Bookmark this page
What Is A Table? Can You
Describe Different Types
Of Tables Used In
Database?
What's The Difference Of
C++ And Java Script?
What Are The Importance
Of Database Management
System?
How To Write Order Of
Events In Microsoft Word?
How The Distributed
Database Different From
Centralized Database?
What is a client server
database?
What do you about Role of
database administrator?
How To Delete Sqlite
Files?
What is trigger in SQL
and why do you use
trigger in SQL?
is it possible to delete
one row among two that
are similar of each other
in a database...
My Blurtit
My Profile
My Questions
My Answers
Blurtit Features
Ask a Question
Answer a Question
Search an Answer
Categories
Tools
Link to Blurtit
Add Blurtit to Firefox
Search Engine
See Your Site Here
Link to Blurtit
RSS
Blurtit.com
About Us
Terms & Conditions
Privacy Policy
Contact Us
Advertise With Us
Help
International
 Chinese Site
 Japanese Site
To continue you need to be registered with us first.

I am already a Blurter, and need to login
I am not a Blurter yet, but would like to register