Table creation: Difference between revisions
Content added Content deleted
mNo edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
addrZIP Char(10) not null |
addrZIP Char(10) not null |
||
) |
) |
||
==[[MySQL]]== |
|||
CREATE TABLE `Address` ( |
|||
`addrID` int(11) NOT NULL auto_increment, |
|||
`addrStreet` varchar(50) NOT NULL default '', |
|||
`addrCity` varchar(25) NOT NULL default '', |
|||
`addrState` char(2) NOT NULL default '', |
|||
`addrZIP` char(10) NOT NULL default '', |
|||
PRIMARY KEY (`addrID`) |
|||
); |
Revision as of 15:54, 21 January 2007
![Task](http://static.miraheze.org/rosettacodewiki/thumb/b/ba/Rcode-button-task-crushed.png/64px-Rcode-button-task-crushed.png)
You are encouraged to solve this task according to the task description, using any language you may know.
In this task, the goal is to create a table to store addresses.
UDB DB2
CREATE TABLE Address ( addrID Integer generated by default as identity, addrStreet Varchar(50) not null, addrCity Varchar(25) not null, addrState Char(2) not null, addrZIP Char(10) not null )
MySQL
CREATE TABLE `Address` ( `addrID` int(11) NOT NULL auto_increment, `addrStreet` varchar(50) NOT NULL default , `addrCity` varchar(25) NOT NULL default , `addrState` char(2) NOT NULL default , `addrZIP` char(10) NOT NULL default , PRIMARY KEY (`addrID`) );