Jump to content

SQL+ Oracal Support PK AND FK


1nstan7

Recommended Posts

2lntppi.jpg

Well Did I do w3schoolhelp and overclock Right?

CREATE TABLE W3schoolhelp (aircraft_code CHAR(5) primary key,HTML CHAR(20),);CREATE TABLE Overclock_test(purchase_order_no NUMBER(3) primary key,coding CHAR(4) not null,PC INT(4),CONSTRAINT f_coding  FOREIGN KEY (coding}REFERENCES coder(coding)  );

I'm not sure if I did the caps or if I missed anything?Also if you look at stackoverflow_help it has overclocking which is a primary key and a Forgien? How do I do that?Anyway all help is appreciated!

 

Link to comment
Share on other sites

The column names in the diagram don't match the SQL statements. I don't see much of a reason to have something be both a primary and a foreign key. If it is a primary key that means it's unique in the table. If it's a foreign key that means it's also in another table. If you have unique data like that then it can all go in one table.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...