Question

Hey can anyone help me fix the logic in these CREATE statements? The create SITE will...

Hey can anyone help me fix the logic in these CREATE statements? The create SITE will not run because it gets a "no matching unique or primary key for this column-list". I already asked this question before the expert before gave the wrong answer

CREATE TABLE OLMP_COUNTRY (

 

NOC CHAR(3),

 

TEAM VARCHAR2(100),

 

CITY VARCHAR2(100),

 

CONSTRAINT country_pk PRIMARY KEY(NOC)

 

);

 

 

 

 

 

CREATE TABLE ATHLETE (

 

ATHELTE_ID CHAR(8),

 

NAME VARCHAR2(100),

 

AGE CHAR(3),

 

SEX CHAR(1),

 

HEIGHT CHAR(3),

 

WEIGHT DECIMAL(3,1),

 

NOC CHAR(3),

 

CONSTRAINT athlete_pk PRIMARY KEY(ATHLETE_ID),

 

CONSTRAINT country_fk FOREIGN KEY(NOC) REFERENCES OLMP_COUNTRY(NOC)

 

);

 

 

 

 

 

CREATE TABLE SITE (

 

NOC CHAR(3),

 

CITY VARCHAR2(100),

 

SEASON VARCHAR2(20),

 

YEAR CHAR(4),

 

CONSTRAINT site_pk PRIMARY KEY(NOC),

 

CONSTRAINT country_fk FOREIGN KEY(CITY) REFERENCES OLMP_COUNTRY(CITY)

 

 

 

);

 

 

 

 

 

CREATE TABLE RESULTS (

 

RESULT_ID CHAR(8),

 

MEDAL CHAR(6),

 

ATHLETE_ID CHAR(8),

 

SPORT_EVENT VARCHAR2(100),

 

YEAR CHAR(4),

 

GAMES VARCHAR2(50),

 

CONSTRAINT results_pk PRIMARY KEY(RESULTS_ID)

 

);

 

 

 

CREATE TABLE EVENT (

 

SPORT_EVENT VARCHAR2(100),

 

SPORT VARCHAR2(50),

 

GAMES VARCHAR2(50)

 

CONSTRAINT event_pk PRIMARY KEY(SPORT_EVENT)

 

);

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Below i am giving the correct query .There was some syntax error and spelling mistakes in the given query.you can run the below query successfully..pls run it.

Query

CREATE TABLE OLMP_COUNTRY (

NOC CHAR(3),

TEAM VARCHAR2(100),

CITY VARCHAR2(100),

CONSTRAINT country_pk PRIMARY KEY(NOC)

);

CREATE TABLE ATHLETE (

ATHELTE_ID CHAR(8),

NAME VARCHAR2(100),

AGE CHAR(3),

SEX CHAR(1),

HEIGHT CHAR(3),

WEIGHT DECIMAL(3,1),

NOC CHAR(3),

CONSTRAINT athlete_pk PRIMARY KEY(ATHELTE_ID ),

CONSTRAINT country_fk FOREIGN KEY(NOC) REFERENCES OLMP_COUNTRY(NOC));

CREATE TABLE SITE (

NOC CHAR(3),

CITY VARCHAR2(100),

SEASON VARCHAR2(20),

YEAR CHAR(4),

CONSTRAINT site_pk PRIMARY KEY(NOC),

CONSTRAINT country_fk FOREIGN KEY(CITY) REFERENCES OLMP_COUNTRY(CITY)

);

CREATE TABLE RESULTS (

RESULT_ID CHAR(8),

MEDAL CHAR(6),

ATHLETE_ID CHAR(8),

SPORT_EVENT VARCHAR2(100),

YEAR CHAR(4),

GAMES VARCHAR2(50),

CONSTRAINT results_pk PRIMARY KEY(RESULT_ID)

);

CREATE TABLE EVENT (

SPORT_EVENT VARCHAR2(100),

SPORT VARCHAR2(50),

GAMES VARCHAR2(50),

CONSTRAINT event_pk PRIMARY KEY(SPORT_EVENT)

);

******************END***********PLS GIVE ME UPVOTE********************

Add a comment
Know the answer?
Add Answer to:
Hey can anyone help me fix the logic in these CREATE statements? The create SITE will...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Having trouble creating SQL data base. Need help trying to correct the following data so that...

    Having trouble creating SQL data base. Need help trying to correct the following data so that it will run... CREATE TABLE CUSTOMER_T (Customer_ID VARCHAR2(10), CUSTOMER_NAME VARCHAR2(50), CUSTOMER_STREET VARCHAR2(50), CUSTOMER_CITY VARCHAR2(25), CUSTOMER_STATE VARCHAR2(2), CUSTOMER_POSTAL_CODE VARCHAR2(9), CUSTOMER_TYPE VARCHAR2(20), LOCATION_ID VARCHAR2(15), CONSTRAINT CUSTOMER_PK PRIMARY KEY (CUSTOMER_ID), CONSTRAINT CUSTOMER_FK FOREIGN KEY(LOCATION_ID) REFERENCES LOCATION_T (LOCATION_ID)); CREATE TABLE LOCATION_T (LOCATION_ID VARCHAR2(15), LOCATION_NAME VARCHAR2(30), LOCATION_COUNTRY VARCHAR2(30), CONSTRAINT LOCATION_PK PRIMARY KEY (LOCATION_ID), CONSTRAINT LOCATION_FK FOREIGN KEY(RATE_ID) REFERENCES LOCATION(LOCATION_ID)); CREATE TABLE RATE_T (RATE_ID VARCHAR2(15), RATE_CLASS VARCHAR2(20), RATE_PER_kwh NUMBER(10,2), CONSTRAINT...

  • For each city, list number of customers from the city, who have placed order(s). Cities are...

    For each city, list number of customers from the city, who have placed order(s). Cities are listed in ascending alphabetical order. Use equal join for this query. CREATE TABLE customer ( cust_id number(11,0) not null, cust_name varchar2(25) not null, street varchar2(30), city varchar2(20), state varchar2(2), zipcode varchar2(5), CONSTRAINT customer_pk PRIMARY KEY (cust_id) ); CREATE TABLE ordertable ( order_id number(11,0) not null, order_date date, cust_id number(11,0), CONSTRAINT order_pk PRIMARY KEY (order_id), CONSTRAINT order_fk FOREIGN KEY (cust_id) REFERENCES customer (cust_id)); CREATE TABLE...

  • The following SQL DDL script creates a database for a social network application. create table userProfile(...

    The following SQL DDL script creates a database for a social network application. create table userProfile( id char(10) primary key, firstName varchar(20), lastName varchar(20), dob date, email varchar(30) ); create table foaf( userid char(10), friendID char(10), timeEstablished date, constraint pk primary key(userid, friendID), constraint fk1 foreign key(userid) references userProfile(id), constraint fk2 foreign key(friendID) references userProfile(id) ); create table activity( actID char(20) primary key, topic varchar(20), description varchar(100), location varchar(20), ActivityDate date, hostUser char(10), foreign key(hostUser) references userProfile(id) ); create table...

  • CREATE TABLE Gender ( gender CHAR(1), description VARCHAR(10), PRIMARY KEY (gender) ); CREATE TABLE People (...

    CREATE TABLE Gender ( gender CHAR(1), description VARCHAR(10), PRIMARY KEY (gender) ); CREATE TABLE People ( ID INT, name VARCHAR(50), gender CHAR(1), height FLOAT, PRIMARY KEY (ID), FOREIGN KEY (gender) REFERENCES Gender (gender) ); CREATE TABLE Sports ( ID INT, name VARCHAR(50), record FLOAT, PRIMARY KEY (ID), UNIQUE (name) ); CREATE TABLE Competitions ( ID INT, place VARCHAR(50), held DATE, PRIMARY KEY (ID) ); CREATE TABLE Results ( peopleID INT NOT NULL, competitionID INT NOT NULL, sportID INT NOT NULL,...

  • Utilize the JigSaw SQL file below to create a Star Schema diagram. Remember, to create a...

    Utilize the JigSaw SQL file below to create a Star Schema diagram. Remember, to create a Star Schema from a normalized data model, you will need to denormalize the data model into fact and dimension tables. The diagram should contain all of the facts and dimension tables necessary to integrate the JigSaw operational database into a data warehouse. Write a brief paper describing the challenges you experienced in completing this assignment. -- CREATE DATABASE js; CREATE TABLE buy_methods ( buy_code...

  • NEED HELP IN INSERT STATEMENTS FOR THE TABLES CAN YOU PLEASE ADD SOME INSERT STATEMENTS FOR...

    NEED HELP IN INSERT STATEMENTS FOR THE TABLES CAN YOU PLEASE ADD SOME INSERT STATEMENTS FOR A COMPANY SCHEMA SCRIPT. PLEASE ADN THANK YOU DROP TABLE dependent; DROP TABLE works_on; DROP TABLE project; DROP TABLE dept_locations; DROP TABLE department; DROP TABLE employee; CREATE TABLE employee ( fname varchar(15) not null, minit varchar(1), lname varchar(15) not null, ssn char(9), bdate date, address varchar(50), sex char, salary numeric(10,2), superssn char(9), dno numeric, primary key (ssn), foreign key (superssn) references employee(ssn) ); CREATE...

  • Create a new database and execute the code below in SQL Server’s query window to create...

    Create a new database and execute the code below in SQL Server’s query window to create the database tables. CREATE TABLE PhysicianSpecialties (SpecialtyID integer, SpecialtyName varchar(50), CONSTRAINT PK_PhysicianSpecialties PRIMARY KEY (SpecialtyID)) go CREATE TABLE ZipCodes (ZipCode varchar(10), City varchar(50), State varchar(2), CONSTRAINT PK_ZipCodes PRIMARY KEY (ZipCode)) go CREATE TABLE PhysicianPractices (PracticeID integer, PracticeName varchar(50), Address_Line1 varchar(50), Address_Line2 varchar(50), ZipCode varchar(10), Phone varchar(14), Fax varchar(14), WebsiteURL varchar(50), CONSTRAINT PK_PhysicianPractices PRIMARY KEY (PracticeID), CONSTRAINT FK_PhysicianPractices_ZipCodes FOREIGN KEY (ZipCode) REFERENCES Zipcodes) go CREATE...

  • An online company sells hundreds of office supply products on its e-Commerce store. It has asked...

    An online company sells hundreds of office supply products on its e-Commerce store. It has asked you to design and implement a sales order processing system which will be used by users in our Operations department to process sales orders. Here is an overview of the sales order process. Customers make purchases by placing orders. Each customer has a customer number and profile (such as name, shipping address). To simplify the matter, each time an order is placed, only one...

  • MICROSOFT SQL SERVER - Create the following views 1.List the employee assigned to the most projects...

    MICROSOFT SQL SERVER - Create the following views 1.List the employee assigned to the most projects 2.List the project with the most hours SCRIPT TO BUILD DATABASE create table department ( dept_ID int not null , dept_name char(50) NOT NULL, manager_ID int not null, manager_start_date date not null, constraint Dept_PK primary key (dept_ID), constraint D_Name_AK unique (dept_name) ); insert into department values(1,'abc',1,'2019-01-08'); insert into department values(2,'abc2',2,'2019-01-08'); insert into department values(3,'abc3',2,'2019-01-08'); insert into department values(4,'abc4',2,'2019-01-08'); /*project table done*/ create table project...

  • Hello, Does anyone have any input on how to fragment this table in visual studio? CREATE...

    Hello, Does anyone have any input on how to fragment this table in visual studio? CREATE TABLE [dbo].[Stock] ( [itemNo] INT NOT NULL , [store] VARCHAR(50) NOT NULL, [qtyOnHand] INT NULL, [qtyHand] INT NULL, [qtyOnOrder] INT NULL, [reorderPoint] INT NULL, CONSTRAINT [FK_Stock_Item] FOREIGN KEY ([itemNo]) REFERENCES [Item]([itemNo]), CONSTRAINT [FK_Stock_Store] FOREIGN KEY ([store]) REFERENCES [Store]([storeName]), CONSTRAINT [PK_Stock] PRIMARY KEY ([itemNo], [store]), The other tables are: CREATE TABLE [dbo].[Item] ( [itemNo] INT NOT NULL PRIMARY KEY, [itemName] VARCHAR(50) NULL, [supplier] VARCHAR(50) NULL,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT