Chapter varchar varchar varchar varchar you now desc customer
|
|
|
---|---|---|
address2 | ||
state | ||
zip | ||
country |
);
If you now do a desc customer, you’ll see that your table is in place. There are, however, a few problems that you will run into immediately. First, the custid will be used to identify your customers uniquely. You don’t want someone using the same cus-tomer identification (id) twice. There is an easy way to prevent this from happening—just issue the following command:
TIP |
---|
CREATE TABLE customer (
custid NUMBER(4) PRIMARY KEY,
fname VARCHAR2(30),
lname VARCHAR2(30),
email VARCHAR2(30),
address1 VARCHAR2(50),
address2 VARCHAR2(50),
state VARCHAR(5),
zip VARCHAR(10),
country VARCHAR(5) DEFAULT ‘USA’
);
Oracle SQL | 163 |
---|
Now, one thing you do want your user to define is his or her last name. If you don’t define the last name, the row will be completely useless. You can require that the last name be defined as follows:
NOTE There are many other storage options for your table that allow you to fine-tune how your data is stored. They require a deep understanding of the Oracle architecture to be used properly. These options are beyond the scope of this text and aren’t covered here.