User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Database Design section within the Web Development category of DaniWeb, a massive community of 426,188 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,791 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Database Design advertiser: Programming Forums
Views: 1817 | Replies: 0
Reply
Join Date: Sep 2005
Posts: 139
Reputation: aarya is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
aarya's Avatar
aarya aarya is offline Offline
Junior Poster

mysql tutorials

  #1  
Aug 28th, 2006
What is a database?

A database is a collection of data stored in some organized fashion. The simplest way is to think of it is to imagine a database as a filling cabinet.

What are tables in the database?

When you want to store some file with information you just can’t toss it in the drawer. Rather you create file within the filling cabinets and then add related file in a specific files.
In the database language we call files as tables. Ale is a structured file that can store data of a specific type. A table might contain a list of customers, name, ID or any other list of information.

What are columns and data types?

Tables are made up of columns. A column contains a particular piece of information within a table. Column is single field in a table. All the tables are made up of one or more columns. Data in a table is stored in rows; each record saved is stored in its own row. Row is a record in a table

Keys

Every row in a table should have some column that uniquely identifies it. Table containing student information might use student roll number for this purpose.

What is SQL?

SQL is an abbreviation for Structured Query Language. SQL is a language designed mainly for communicating with databases. SQL is easy to learn. The statements are all made up of descriptive English word. SQL is designed to do only one work that is communicating with database in a simple and efficient way.

Creating tables

SQL is not just used for table data manipulation. Rather sql can be used to perform all database and table operations, including the creation and manipulation of tables themselves. There are two ways to create database tables:

Most DBMSs come with an administration tool that can be used to create and manage database tables interactively

Tables may also be manipulated directly with SQL statements

To create tables, CREATE TABLE sql statement is used.

Basic table creation
To create the new table you must specify the following information
The name of the new table specified after keywords CREATE TABLEM’S
The name and definition of the table columns separated by commas
Some DBMSs require that you also specify the table location
The following SQL statement creates the students table

Create table students
( 
student_name char(50) not null,
student_age char(10) not null,
student_marks car(10) not null
);

Now we will see how to insert that data into the database

As it is name suggest INSERT is used to insert (add) rows to a database table insert can be used in several ways
Inserting a full single row
Inserting single partial row
Inserting the results of a query

Inserting complete rows

The simplest way to insert data into a table is to use the basic INSERT syntax, which requires table name and the values to be inserted into a new row.

Here is the example

INSERT into student values (‘hari’,’10’,’98’);
The meaning of the above statement
INSERT into student values (‘name’,’age’,’marks’);
The above example inserts a new student into a student table. Although the syntax is simple but is not the safe methods. The above SQL statement is highly dependent on the order in which the columns are defined in the table. The safer way to write the INSERT Statement is as follows

Insert into student (student_name,student_age,student_marks) values (‘hari’,’10’,’98’);


To delete (remove) data from a table, the delete statement is used. Delete can be used in two ways.

To delete specific rows forma a table
To delete all rows from table
The following statement delete is a single row from the student table

DELETER FROM students where id=’100’;
THIS STATEMENT IS SELF EXPLANTORY. Delete form requires that you specify the name of the table form which the data is to be deleted. The WHERE Clause filters which rows are to be deleted. In this example only student whose id is 100 will be deleted. If the WHERE clause were omitted, this statement would be deleted every customer in the table.

Delete takes no columns names or wildcard characters. Delete deletes entire rows not columns
Last edited by happygeek : Oct 28th, 2006 at 9:15 am. Reason: Formatting
increase youe site traffic

http://www.articleboards.com

Running free html asp php jsp xml xhtml j2ee mysql tutorials

http://www.freewebschools.com

Submit your design portfolio and increase your popularity

http://designers-portfolio.com
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Database Design Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Database Design Forum

All times are GMT -4. The time now is 6:48 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC