BDI Tema11 Danuta Laurentiu
BDI Tema11 Danuta Laurentiu
BDI Tema11 Danuta Laurentiu
11
Observaţie!
Scrieţi rezolvarea direct în acest document!
DESCRIBE graduate_candidates;
3. Create a new table using a subquery. Name the new table your last name -- e.g.,
smith_table. Using a subquery, copy grad_candidates into smith_table.
CREATE TABLE hello_table
AS ( SELECT * FROM graduate_candidates);
4. Insert your personal data into the table created above.
5. Using the column information for the animals table below, name constraints where applicable
at the table level, otherwise name them at the column level. Define the primary key
(animal_id). The license_tag_number must be unique. The admit_date and vaccination_date
columns cannot contain null values.
6. Create the animals table. Write the syntax you will use to create the table.
);
7. Enter one row into the table. Execute a SELECT * statement to verify your input. Refer to
the graphic below for input.
10. Create a FOREIGN KEY constraint in the copy_d_events table. Name the foreign key
copy_d_events_fk. This key references the copy_d_clients table client_number column.
What is the syntax you used to create the FOREIGN KEY constraint in the copy_d_events
table?
ALTER TABLE copy_d_events
ADD CONSTRAINT copy_d_eve_client_number_fk FOREIGN KEY (client_number)
REFERENCES copy_d_clients (client_number) ENABLE;
11. Use a SELECT statement to verify the constraint names for each of the tables. Note that
the tablenames must be capitalized.
b. The constraint name for the foreign key in the copy_d_events table is
COPY_D_EVE_CLIENT_NUMBER_FK
12. Create an ALTER TABLE query to disable the primary key in the copy_d_clients table.
Then add the values from #6 to the copy_d_events table. Explain your results.
INSERT INTO
copy_d_events(client_number,id,name,event_date,description,cost,venue_id,package_code,them
e_code)
VALUES(7125,140,'John Bay Fach',TO_DATE('13-Aug-2008','dd-Mon-yyyy'),'Wedding
day',4500,105,87,77);