Which is a valid CREATE TABLE statement?

Which is a valid CREATE TABLE statement?

Which is a valid CREATE TABLE statement?

A.
CREATE TABLE EMP9$# AS (empid number(2));

B.
CREATE TABLE EMP*123 AS (empid number(2));

C.
CREATE TABLE PACKAGE AS (packid number(2));

D.
CREATE TABLE 1EMP_TEST AS (empid number(2));

Explanation:
Table names and column names must begin with a letter and be 1-30 characters
long. Characters A-Z,a-z, 0-9, _, $ and # (legal characters but their use is discouraged).
Incorrect answer:
BNon alphanumeric character such as * is discourage in Oracle table name.
DTable name must begin with a letter.
Refer: Introduction to Oracle9i: SQL, Oracle University Study Guide, 9-4



Leave a Reply 8

Your email address will not be published. Required fields are marked *


Bina

Bina

Why is C wrong?
PACKAGE is a reserve word?

Gabriel K

Gabriel K

Yes.

Sagar

Sagar

So what? We can still create table with name PACKAGE, thatswhy option C is a valid statement.

bina

bina

CREATE TABLE PACKAGE (packid number(2));
CREATE A TABLE
C is also right.

Gabriel K

Gabriel K

I think PACKAGE is reserved word as you mention in below post

reach

reach

Actually all 4 are invalid becasue “AS” keyword cannot be used here.

dj

dj

the as keyword should not be there

Justyna

Justyna

Number 162 in this set is the same question with correct syntax:
Which is the valid CREATE [TABLE statement?

A. CREATE TABLE emp9$# (emp_no NUMBER(4));
B. CREATE TABLE 9emp$# (emp_no NUMBER(4));
C. CREATE TABLE emp*123 (emp_no NUMBER(4));
D. CREATE TABLE emp9$# (emp_no NUMBER(4). date DATE);

There is also long explanation about naming rules for objects.