0

Hi everybody,
I am Hugo . I want to know something more about SQL.
please can anybody give me some idea about some basic SQl questions?
First of all i want to know,
1.What is the SQL Data Manipulation Language(DML)?
2.What is the SQL Data Defenition Language(DDL)?

7
Contributors
13
Replies
14
Views
10 Years
Discussion Span
Last Post by nav33n
0

Hi Hug,
I think i can help you,
SQL is syntax for executing queries and updating,inserting and deleting records.These query and update commands together form the DML.
And, the DDL part of SQL provides syntax for creating or deleting database tables.Also define keys,specify links between tables and impose constraints between database tables.

0

DML or Data manipulation language is nothing but "How do you manipulate the data in a table". You can manipulate the data in these ways.
1. Selecting the data from the table (Select)
2. Inserting the data to the table (Insert)
3. Updating the data in the table (Update)
4. Deleting the data from the table (Delete)

Data definition language means how do you define/change the database objects. They are,
1. Creating a database object Eg.Table (Create)
2. Changing the table structure (Alter)
3. Deleting/Dropping the table (Drop).


Edit: ravisen22 you beat me by 2 mins. :)

0

Hello...Hug..
If you want , i will give some examples also.
DML part of SQL are:
1.SELECT-extracts data from a database table.
2.UPDATE-update data in a database table.
3.DELETE-delete data from a database table.
4.INSERT INTO-inserts new data into a database table.

DDL part of SQL are:
1.CREATE TABLE-creates a new database table.
2.ALTER TABLE-alters a database table.
3.DROP TABLE-deletes a database table.
4-CREATE INDEX-creates an index.
5.DROP INDEX-deletes an index.

0

Hi,
Thank you ravise22.
And thank you nav33n.
Both of you gave me some good knowledgeabout SQL languages like DDL and DML. At the same time both of you gave me suffiecient examples also. Thanx.

0

Hey,
I have some more doubts also.
One is ,
What r normalization and denormalization?
And,What is an index, and how is it used to improve perfomance?

0

Normalization is a difficult theory to explain. You should read it yourself to understand it better. But in short, normalization is a process following which, you can optimize the performance of your database. (Eg. By avoiding obsolete data, duplication, and by using primary keys, etc).

Index is just like the index of a book. If you want a particular topic in a book, you refer the index page of that book and go to that respective topic. Index in database, is kinda same. It increases the speed w.r.t the operations on a table.

You should go through http://w3schools.com/sql/sql_intro.asp :)

0

What is an alternate key in a table ?
Please tell more about foreign key an primary key ?
Please show one example that how we can eliminate duplicate column(s) from one table?

0

Hi
In a database table,apart from primary key columns,other column, may need to be a key.These are alternate key.This column value may or may not be unique one.
A key column in a table that identifies records in a different table is called foreign key.

0

To avoid duplication in column(s) we can create it with unique costraint. Constraint is nothing but rules that you can impose on the columns to be unique or not null etc. To create a unique column you can have the codes like:
create table mytable(col1 datatype unique, col2 datatype,...)

0

Oh, btw, if you have any duplicate rows, *I dont think it is possible to delete only the duplicate rows. You have to manually (:() delete them. *

Edit: The only way i can think of is, create a dummy table(new_table). Copy distinct rows from old_table to new_table. Truncate old_table. Copy the records from new_table to old_table. I cant think of ANY query to delete duplicate records from a table.

0

To avoid duplication in column(s) we can create it with unique costraint. Constraint is nothing but rules that you can impose on the columns to be unique or not null etc. To create a unique column you can have the codes like:
create table mytable(col1 datatype unique, col2 datatype,...)

Or declare it as a primary key. Primary key is a combination of both "not null" and "unique" constraints.

0

For aggregate functions like SUM, AVG, MIN, MAX etc, you should use group by clause. Group by clause groups the records depending upon the table field you mention. Say, for eg, you have a table. This table has 2 columns, student_marks and subject. You want to know the average marks of each subject. You can do this using the group by clause. select avg(student_marks) from table group by subject This will calculate the average marks of each subject and shows the average marks for each subject.
Cheers,
Nav

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.