a*****i 发帖数: 4391 | 3
select * from
Yup.
【在 r***n 的大作中提到】 : 1. When you give the 'select' command in SQL, is it to 'select * from : ' or to 'select * from '? : 2. 一个表的外键(foreign key)是否一定是另一个表的主键(prime key)?
j**y 发帖数: 147 | 4 在 Roman (想念她的教授) 的大作中提到: 】
I don't think so. See the following:
CREATE TABLE EMPLOYEE
( FNAME VARCHAR(15) NOT NULL,
LNAME VARCHAR(15) NOT NULL,
SSN CHAR(9) NOT NULL,
......
SUPERSSN CHAR(9),
.....
PRIMARY KEY (SSN)
FOREIGN KEY (SUPERSSN) REFERENCES EMPLOYEE(SSN));
The foreign key of this table references the primary key of itself. | l***u 发帖数: 157 | 5
So its foreign key is its primary key. The importance is it must be
a primary key no matter belongs to which table.
【在 j**y 的大作中提到】 : 在 Roman (想念她的教授) 的大作中提到: 】 : I don't think so. See the following: : CREATE TABLE EMPLOYEE : ( FNAME VARCHAR(15) NOT NULL, : LNAME VARCHAR(15) NOT NULL, : SSN CHAR(9) NOT NULL, : ...... : SUPERSSN CHAR(9), : ..... : PRIMARY KEY (SSN)
| a*****i 发帖数: 4391 | 6
Your point?
【在 j**y 的大作中提到】 : 在 Roman (想念她的教授) 的大作中提到: 】 : I don't think so. See the following: : CREATE TABLE EMPLOYEE : ( FNAME VARCHAR(15) NOT NULL, : LNAME VARCHAR(15) NOT NULL, : SSN CHAR(9) NOT NULL, : ...... : SUPERSSN CHAR(9), : ..... : PRIMARY KEY (SSN)
|
|