CREATE SEQUENCE ORD_SEQ Increment by 10 Start with 120 Maxvalue 9999 Nocycle; CREATE TABLE ORD_ITEMS (ord_no NUMBER (4) DEFAULT ORD_SEQ.NEXTVAL NOT NULL, Item_no NUMBER(3), sys_date DATE DEFAULT SYSDATE, expiry_date DATE, qty NUMBER(3) CHECK (qty BETWEEN 100 AND 200), CONSTRAINT expiry_date_ck CHECK ( expiry_date > sys_date ), CONSTRAINT its_pky PRIMARY KEY (ord_no, item_no), CONSTRAINT ord_fky FOREIGN KEY(ord_no) REFERENCES orders(order#) ); The command to create the table fails. What causes the failure? 1. An error will occur because you cannot use SYSDATE in the condition of a check constraint. 2. An error will occur because the BETWEEN clause in the condition of a CHECK constraint. 3. An error will occur because you cannot use the NEXTVAL sequence value as a DEFAULT value for a column. 4. This piece of code will execute without any errors
SQL
SQL stands for Structured Query Language, is a form of communication that uses queries structured in a specific format to store, manage & retrieve data from a relational database.
Queries
A query is a type of computer programming language that is used to retrieve data from a database. Databases are useful in a variety of ways. They enable the retrieval of records or parts of records, as well as the performance of various calculations prior to displaying the results. A search query is one type of query that many people perform several times per day. A search query is executed every time you use a search engine to find something. When you press the Enter key, the keywords are sent to the search engine, where they are processed by an algorithm that retrieves related results from the search index. Your query's results are displayed on a search engine results page, or SER.
Evaluate the following SQL commands:
CREATE SEQUENCE ORD_SEQ
Increment by 10
Start with 120
Maxvalue 9999
Nocycle;
CREATE TABLE ORD_ITEMS
(ord_no NUMBER (4) DEFAULT ORD_SEQ.NEXTVAL NOT NULL,
Item_no NUMBER(3),
sys_date DATE DEFAULT SYSDATE,
expiry_date DATE,
qty NUMBER(3) CHECK (qty BETWEEN 100 AND 200),
CONSTRAINT expiry_date_ck CHECK ( expiry_date > sys_date ),
CONSTRAINT its_pky PRIMARY KEY (ord_no, item_no),
CONSTRAINT ord_fky FOREIGN KEY(ord_no) REFERENCES orders(order#)
);
The command to create the table fails. What causes the failure?
1.
An error will occur because you cannot use SYSDATE in the condition of a check constraint.
2.
An error will occur because the BETWEEN clause in the condition of a CHECK constraint.
3.
An error will occur because you cannot use the NEXTVAL sequence value as a DEFAULT value for a column.
4.
This piece of code will execute without any errors

Trending now
This is a popular solution!
Step by step
Solved in 2 steps









