MySQL Forums
Forum List  »  Newbie

Re: How do I start?
Posted by: Ramalingam Chelliah
Date: August 16, 2004 10:16PM

Hi,
Here is the syntax...

mysql> create database xxx;
mysql>use xxx;

mysql>create table table1 ( Roll integer NOT NULL UNIQUE,Name varchar(10),Mark integer) ;

Here 'Roll' column should not be null and it should be unique (Primary key)

( If null value '\N' is inserted for 'Roll' then 0 (or '' for varchar field) will be substituted automatically. However there is a configuration which could avoid this and report an error...

See:
http://dev.mysql.com/doc/mysql/en/constraint_NOT_NULL.html

)

mysql>insert into table1 values
(1,'Ram',90),(2,'Rigue',91),(3,'NickRoper',95),(4,'Jens',91);

mysql>select * from table1;
(shows the whole table)

mysql> desc table1
( shows table structure )

mysql> alter table table1 ADD(Rank integer) ;
(Alters the table structure)Adds a new column to the existing table

Search for other syntax here in this forum or online manual



Hope this helps ...

Regards,
Ram.


Options: ReplyQuote


Subject
Written By
Posted
August 16, 2004 03:59PM
Re: How do I start?
August 16, 2004 10:16PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.