Which CREATE TABLE statement is valid?
A.
CREATE TABLE ord_details
(ord_no NUMBER(2) PRIMARY KEY,
item_no NUMBER(3) PRIMARY KEY,
ord_date DATE NOT NULL);
B.
CREATE TABLE ord_details
(ord_no NUMBER(2) UNIQUE, NOT NULL,
item_no NUMBER(3),
ord_date DATE DEFAULT SYSDATE NOT NULL);
C.
CREATE TABLE ord_details
(ord_no NUMBER(2) ,
item_no NUMBER(3),
ord_date DATE DEFAULT NOT NULL,
CONSTRAINT ord_uq UNIQUE (ord_no),
CONSTRAINT ord_pk PRIMARY KEY (ord_no));
D.
CREATE TABLE ord_details
(ord_no NUMBER(2),
item_no NUMBER(3),
ord_date DATE DEFAULT SYSDATE NOT NULL,
CONSTRAINT ord_pk PRIMARY KEY (ord_no, item_no));
For option D: isn’t it incorrect since you cannot use SYSDATE as the DEFAULT Date value?
It´s correct, because don´t have clause CHECK, and only doing inserts with default sysdate
hi. But what is the problem with a ?
They tried to created a compound primary key, but the syntax is not correct. Every table must have just one PK.
Correct way to create a compound PK.
CONSTRAINT ord_pk PRIMARY KEY (ord_no, item_no));
They tried to created a compound primary key, but the syntax is not correct.
Correct way to create a compound PK.
CONSTRAINT ord_pk PRIMARY KEY (ord_no, item_no));
does constraint word absent ?
A is incorrect: only one primary key allowed per table.
yes yes yes sureeeee
Why isnt B correct??
It is not necessary that each table has a primary key.
B is not correct because of that line:
ord_no NUMBER(2) UNIQUE, NOT NULL,
Unique + no null = PK 🙂
And because of that D is more valid answer.
B is not correct because of the comma (,) typed between UNIQUE and NOT NULL.
Unique + not null does NOT indicates it is PK. The table does NOT have to have a PK. Just a simple syntax error (for having an extra comma)
y is not c is corect?
You cannot designate the same column or combination of columns as both a primary key and a unique key.
http://docs.oracle.com/cd/B28359_01/server.111/b28286/clauses002.htm
This is because the primary key constraint implies the creation of a unique index. So you would create the same index on the same column(s) twice.
D
c is also corect i think.??
Thanks Alvin2201 for clarifying the doubt on indexing 🙂
Pretty great post. I simply came across your weblog and planned to mention that I’ve really enjoyed surfing around your site posts. After all I’ll be subscribing with your rss feed and I am hoping you are submitting again soon!|
rca ieftin http://goo.gl/6GqA7S
Este es un lista de las palabras frases, no un ensayo. Usted es que son incompetentes
http://www.opinionesdating.com/meetic-opiniones/
Every as soon as inside a whilst we pick out blogs that we read. Listed below are the most recent internet sites that we pick out.
Just beneath, are several completely not related web sites to ours, however, they may be certainly worth going over.
Sites of interest we’ve a link to
usually posts some really exciting stuff like this. If you are new to this site
Here are several of the sites we suggest for our visitors.
please stop by the web sites we adhere to, which includes this a single, as it represents our picks in the web
we came across a cool web-site that you simply might get pleasure from. Take a look in case you want
Awesome article.Much thanks again. Will read on…