For the table created,list the column(s)with foreignconstraint(对于创建的表,寫出有foreign…
- User
For the table created,list the column(s)with foreignconstraint(对于创建的表,寫出有foreign constraint的列。)
CREATE TABLE emp_ouyang (employee id NUMBER(6) CONSTRAINT emp employee id PRIMARY KEY ,first_name VARCHAR2(20) last name VARCHAR2(25) CONSTRAINT emp last name nn NOT NULL , email VARCHAR2(25) CONSTRAINT emp email nn NOT NULL CONSTRAINT empemail uk UNIQUE ,job_id VARCHAR2(10) CONSTRAINT emp job_nn NOT NULL ,salary NUMBER(8,2) CONSTRAINT emp salary_ck CHECK(salary>0) commission pct NUMBER(2,2) manager id NUMBER(6) CONSTRAINTemp manager fk REFERENCES employees (employee id,department id NUMBER(4) CONSTRAINT emp_dept_fk REFERENCES departments(department id));
- Assistant
The column with foreign constraint is "manager id" which references "employee id" column in "employees" table. The column "department id" also has a foreign constraint which references "department id" column in "departments" table.
- User
If a table column is of data type number(6-2)which one will be the corrected pair of input and stored values for this column?(如果位的数据类型为 number(6-2),则以下哪些選項是该欄位的輸入值及結果?) a. (9999999999.99 b.(3399.99,3400) c.(9999999error) d. None of the above
- Assistant
b. (3399.99, 3400) is the correct pair of input and stored values for a table column of data type number(6,2).
Explanation:
- The data type number(6,2) specifies that the column can store numbers with a maximum of 6 digits, including 2 digits after the decimal point.
- Option a. (9999999999.99) exceeds the maximum digit limit, and cannot be stored in this column.
- Option b. (3399.99, 3400) has 4 digits before the decimal and 2 digits after the decimal, which satisfies the data type specifications, and can be stored in this column.
- Option c. (9999999error) cannot be stored in this column as it does not follow the numeric data type specifications.
- Option d. None of the above - as mentioned, option b is the correct pair.
- User
Which is/are true aboutschema?(关于schema,哪个是正确的?) a. Eachuserowns a schema.(每个用户都拥有一个schema.) b. Aschema is a set of tables that belongs totheuser(Schema是属干月户 的一组數據表) c.Aschema is created when itsowneris created(Schema是在创建其所有 者时產生的。) d. Aschema can have a different name from its owner'sname(Schema可以 具有与其所有者名称不同的名字) e.Noneoftheabove(以上皆非)
- Assistant
The correct answers are a, b, and d.
Explanation:
- Each user has their own schema in a database.
- A schema is a set of related database objects (such as tables, views, indexes, etc.) that belong to a particular user.
- A schema can be created before or after its owner is created, and can have a different name from its owner's name.
- Therefore, options a, b, and d are all true.
- User
Which of the following constraints can be defined at tablelevel?(以下哪些 constraint可以在tablelevel定义?) not null b. check unique C. d. positive e. foreign key f. None of the above
- Assistant
a. Not null, b. Check, c. Unique, e. Foreign key can be defined at table level.
Explanation:
- Not null constraint can be defined at table level to ensure that a column must have a value and cannot be left blank.
- Check constraint can also be defined at table level to enforce domain integrity by limiting the values that can be inserted into a column.
- Unique constraint can be defined at table level to ensure that no two rows in a table have the same value for a specified column or group of columns.
- Foreign key constraint can also be defined at table level to define the relationship between two tables.
- Positive constraint is not a standard constraint type in SQL, and therefore cannot be defined at table level.
- Therefore, options a, b, c, e are all correct, and the answer is None of the above (f) is incorrect.
- User
Which one is true for primary keyconstraints?(哪些项对于主键constraint是正确的?) a. it creates a primary key for the table b. it enforces uniqueness and not null property c. it can be applied to one colun only d. None of the above
- Assistant
b. It enforces uniqueness and not null property is true for primary key constraints.
Explanation:
- A primary key constraint is used to enforce entity integrity (uniqueness and not null property) on one or more columns in a table.
- The primary key uniquely identifies each row in a table and ensures that no two rows have the same values in the specified column(s).
- While a primary key is often used to create a physical index on a table to improve query performance, it is not explicitly used to "create" a primary key for the table.
- Therefore, options a and c are incorrect and option b is correct. The answer is b.