Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am trying to create these and insert these tables but i am received error mess

ID: 3909156 • Letter: I

Question

I am trying to create these and insert these tables but i am received error message.


CREATE TABLE PATIENT (
2 PATIENT_ID VARCHAR(15),
3 FNAME CHAR(30),
4 LNAME CHAR(30),
5 GENDER CHAR(12),
6 ADDRESS VARCHAR(256),
7 PHONE_NUMBER VARCHAR(20),
8 EMAIL VARCHAR (100),
9 DR_CODE VARCHAR(10),
10 CONSTRAINT doc_pkey PRIMARY KEY (PATIENT_ID),
11 CONSTRAINT patient_doctor_fk FOREIGN KEY (DR_CODE) REFERENCES DOCTOR (DR_CODE)
12 );
CONSTRAINT doc_pkey PRIMARY KEY (PATIENT_ID),
           *
ERROR at line 10:
ORA-02264: name already used by an existing constraint

1) CREATE TABLE products (

product_id         NUMBER         PRIMARY KEY,
category_id        NUMBER         REFERENCES categories (category_id),
product_code       VARCHAR2(10)   NOT NULL      UNIQUE,
product_name       VARCHAR2(255) NOT NULL,
description        VARCHAR2(1500) NOT NULL,
list_price         NUMBER(10,2)   NOT NULL,
discount_percent   NUMBER(10,2)                 DEFAULT 0.00,
date_added         DATE                         DEFAULT NULL   
);


INSERT INTO products (product_id, category_id, product_code, product_name, description, list_price, discount_percent, date_added) VALUES
2 (1, 1, 'strat', 'Fender Stratocaster', 'The Fender Stratocaster is the electric guitar design that changed the world.
3 New features include a tinted neck, parchment pickguard and control knobs, and a ''70s-style logo.
4 /
ERROR:
ORA-01756: quoted string not properly terminated

2) CREATE TABLE CHILD (
2 NAME VARCHAR(20),
3 PARENT VARCHAR(20),
4 ADDRESS VARCHAR(20),
5 SEX CHAR(1),
6 BIRTH DATE);

Table created.

SQL> INSERT INTO child (name,parent,address,sex,birth)
2 VALUES('priya','venkat','13-238_yendada','F',01-12-1994);
VALUES('priya','venkat','13-238_yendada','F',01-12-1994)
                                                  *
ERROR at line 2:
ORA-00932: inconsistent datatypes: expected DATE got NUMBER


create table APPLICATION (
2 A_ID integer primary key,
3 C_ID integer references CANDIDATE(C_ID),
4 J_ID integer references JOB(J_ID),
5 A_APPLY_DATE date,
6 A_STATUS char(9)
7 ) ENGINE = INNODB;
) ENGINE = INNODB
*
ERROR at line 7:
ORA-00922: missing or invalid option


create table STUDENT (
2 s_id int primary key auto_increment,
3 s_fname char(15) not null,
4 s_lname char(15) not null,
5 s_dob date);
s_id int primary key auto_increment,
                     *
ERROR at line 2:
ORA-00907: missing right parenthesis

Explanation / Answer

Still if you getting any errors/have any doubts, please give me comment...

CREATE TABLE PATIENT (

PATIENT_ID VARCHAR(15),

FNAME CHAR(30),

LNAME CHAR(30),

GENDER CHAR(12),

ADDRESS VARCHAR(256),

PHONE_NUMBER VARCHAR(20),

EMAIL VARCHAR (100),

DR_CODE VARCHAR(10),

PRIMARY KEY(PATIENT_ID),

CONSTRAINT patient_doctor_fk FOREIGN KEY (DR_CODE) REFERENCES DOCTOR (DR_CODE)

);

CREATE TABLE products (

product_id NUMBER PRIMARY KEY,

category_id NUMBER REFERENCES categories(category_id),

product_code VARCHAR2(10) NOT NULL UNIQUE,

product_name VARCHAR2(255) NOT NULL,

description VARCHAR2(1500) NOT NULL,

list_price NUMBER(10,2) NOT NULL,

discount_percent NUMBER(10,2) DEFAULT 0.00,

date_added DATE DEFAULT NULL

);

INSERT INTO products (product_id, category_id, product_code, product_name, description, list_price, discount_percent, date_added) VALUES(1, 1, 'strat', 'Fender Stratocaster', 'The Fender Stratocaster is the electric guitar design that changed the world New features include a tinted neck, parchment pickguard and control knobs, and a 70s-style logo.');

CREATE TABLE CHILD (

NAME VARCHAR(20),

PARENT VARCHAR(20),

ADDRESS VARCHAR(20),

SEX CHAR(1),

BIRTH DATE

);

INSERT INTO child(name,parent,address,sex,birth) VALUES('priya','venkat','13-238_yendada','F','01-12-1994');

create table APPLICATION (

A_ID integer primary key,

C_ID integer references CANDIDATE(C_ID),

J_ID integer references JOB(J_ID),

A_APPLY_DATE date,

A_STATUS char(9)

);

create table STUDENT(

s_id int primary key auto_increment,

s_fname char(15) not null,

s_lname char(15) not null,

s_dob date

);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote