Shared web hosting - The AUTHOR table could be created with a
The AUTHOR table could be created with a simple script such as the following: CREATE TABLE Author ( author_id INTEGER NOT NULL, name VARCHAR(32) NULL, CONSTRAINT XPK_Author PRIMARY KEY (author_id), CONSTRAINT XUK_A_Name UNIQUE (name) ); In this script, the primary key is set to the AUTHOR_ID field and the name of the author is set to be unique to ensure that the same author is not added twice, or that two authors do not use the same pseudonym. Foreign Keys Foreign keys are the copies of primary keys created into child tables to form the opposite side of the link in an inter-table relationship establishing a relational database relation. Aforeign key defines the reference for each record in the child table, referencing back to the primary key in the parent table. Figure 3-22 shows that the PUBLICATION table has a foreign key called AUTHOR_ID (FK). This means that each record in the PUBLICATION table has a copy of the parent table s AUTHOR_ID field value, the AUTHOR table primary key value, in the AUTHOR_ID foreign key field on the PUBLICATION table. In other words, an author can have many books published and available for sale at once. Similarly, in Figure 3-22, the COAUTHOR table has a primary key made up of two fields, which also happens to comprise the combination or composite of a two foreign key relationship back to both the AUTHOR table and the PUBLICATION table. The PUBLICATION table could be created with a simple script such as the following: CREATE TABLE Publication ( publication_id INTEGER NOT NULL, subject_id INTEGER NOT NULL, author_id INTEGER NOT NULL, title VARCHAR(64) NULL, CONSTRAINT XPK_Publication PRIMARY KEY (publication_id), CONSTRAINT FK_P_Subject FOREIGN KEY (subject_id) REFERENCES Subject, CONSTRAINT FK_P_Author FOREIGN KEY (author_id) REFERENCES Author, CONSTRAINT XUK_P_Title UNIQUE (title) ); In this script, the primary key is set to the PUBLICATION_ID field. The fields SUBJECT_ID and AUTHOR_ID are set as two foreign key reference fields to the SUBJECT and AUTHOR tables, respectively. A unique key constraint is applied to the title of the publication, ensuring copyright compliance. 60 Chapter 3
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.