Question: Insert 5 records for each table and write complex queries (3+ JOINS / query) using SQL oracle complex queries questions are: Query to find duplicate
Insert 5 records for each table and write complex queries (3+ JOINS / query) using SQL oracle
complex queries questions are:
Query to find duplicate rows in table?
What is the Query to fetch last record from the table?
What is the Query to fetch first record from table?
How to display following using query?
*
**
***
How to add the email validation using only one query?
How to display 1 to 100 Numbers with query?
How to remove duplicate rows from table?
How to find count of duplicate rows?
How to fetch all the records from teachers whose joining year is 2017?
Select all records from tables where name not in Amit and Pradnya
How to get distinct records from the table without using distinct keyword.
these are the codes for the tables created of the school managment system
CREATE TABLE REPORTS ( report_id int, student_id int, date_created date, report_content VARCHAR(50), teachers_comments VARCHAR(50), other_report_details VARCHAR(100), PRIMARY KEY(report_id), FOREIGN KEY(student_id) references student );
CREATE TABLE PURCHASE_DETAILS ( pur_id int, p_id int, vi_id int, i_name VARCHAR(20) NOT NULL, i_quantity int NOT NULL, i_rate int NOT NULL, ipur_date date NOT NULL, i_tax int NOT NULL, i_total int NOT NULL, s_date date NOT NULL, acadimic_year int NOT NULL, PRIMARY KEY(pur_id), FOREIGN KEY(p_id) references product_details, FOREIGN KEY(vi_id) references vendor_details );
CREATE TABLE PRODUCT_DETAILS ( p_id int, vi_id int, pname VARCHAR(20) NOT NULL, ddate date NOT NULL, acadimic_year int NOT NULL, PRIMARY KEY(p_id), FOREIGN KEY(vi_id) references vendor_details );
CREATE TABLE VENDOR_DETAILS ( vi_id int, vrengo int NOT NULL, vname varchar(20) NOT NULL, vaddr varchar(20) NOT NULL, office_cont int NOT NULL, vdate date NOT NULL, acadimic_year int NOT NULL, PRIMARY KEY(vi_id) );
CREATE TABLE SUBJECTS ( subject_id int NOT NULL, subject_name int NOT NULL, class_id int NOT NULL, PRIMARY KEY(subject_id) );
CREATE TABLE ADRESSES ( adress_id int, adress_details VARCHAR(50), PRIMARY KEY(adress_id) );
CREATE TABLE cate_fee ( cat_id int, cat_name VARCHAR(20) NOT NULL, class VARCHAR(20) NOT NULL, fee_amt int NOT NULL, periodf int NOT NULL, periodt int NOT NULL, ddate date NOT NULL, acadimic_year int NOT NULL, PRIMARY KEY(cat_id) );
CREATE TABLE SOFTWARE_SETTINGS ( s_info VARCHAR(20), s_value VARCHAR(20) NOT NULL, ddate date NOT NULL, PRIMARY KEY (s_info) );
CREATE TABLE HOMEWORK ( homework_id int, student_id int, date_created date, homework_content VARCHAR(20), grade int, other_homwork_details VARCHAR(20), PRIMARY KEY (homework_id), FOREIGN KEY (student_id) references student );
CREATE TABLE STUDENT ( student_id int NOT NULL, first_name VARCHAR(20) NOT NULL, middle_name VARCHAR(20) NOT NULL, last_name VARCHAR(20) NOT NULL, date_of_birth date NOT NULL, other_student_details VARCHAR(20) NOT NULL, PRIMARY KEY (student_id) );
CREATE TABLE EXA ( ex_id int, exa VARCHAR(20) NOT NULL, outof int NOT NULL, ddate date NOT NULL, acadimic_year int NOT NULL, PRIMARY KEY (ex_id) );
CREATE TABLE FAMILIES ( family_id int, head_of_family_parent_id int, family_name VARCHAR(20), PRIMARY KEY (family_id), FOREIGN KEY(head_of_family_parent_id) references parent );
CREATE TABLE PARENT ( parent_id int NOT NULL, first_name VARCHAR(20) NOT NULL, middle_name VARCHAR(20) NOT NULL, last_name VARCHAR(20) NOT NULL, date_of_birth date NOT NULL, PRIMARY KEY(parent_id) );
CREATE TABLE EXAM_DATES ( exa_date_id int, ex_id int, edate date NOT NULL, end_date date NOT NULL, d_id int, ex_rec_id int NOT NULL, acadimic_year int NOT NULL, PRIMARY KEY( exa_date_id), FOREIGN KEY(ex_id) references exa
);
CREATE TABLE MARKS ( mark_id int, ex_id int, subject VARCHAR(20) NOT NULL, marks int NOT NULL, outof int NOT NULL, ddate date NOT NULL, edate date NOT NULL, acadimic_year int NOT NULL,
PRIMARY KEY( mark_id), FOREIGN KEY(ex_id) references exa
);
CREATE TABLE SUBJECT_TIME_TABLE ( ext_id int, etimef int NOT NULL, sub_id int, sub_name VARCHAR(20) NOT NULL, exdate date NOT NULL, acadimic_year int NOT NULL, PRIMARY KEY(ext_id), FOREIGN KEY(sub_id) references subjects
);
CREATE TABLE EX_TIME_TABLE ( ext_id int, ex_id int, edate date NOT NULL, cemonth int NOT NULL, eyear int NOT NULL, ddate date NOT NULL, acadimic_year int NOT NULL, PRIMARY KEY(ext_id), FOREIGN KEY(ex_id) references exa );
CREATE TABLE CLASSES ( class_id int NOT NULL subject_id int NOT NULL, teacher_id int NOT NULL, class_code int NOT NULL, date_from date NOT NULL, date_to date NOT NULL, PRIMARY KEY(class_id), FOREIGN KEY(subject_id) references subjects, FOREIGN KEY(teacher_id) references teacher );
CREATE TABLE SCHOOLS ( school_id int NOT NULL, address_id int NOT NULL, school_name VARCHAR(20) NOT NULL, school_principal VARCHAR(20) NOT NULL, other_school_details VARCHAR(20) NOT NULL, PRIMARY KEY(school_id), FOREIGN KEY(address_id) references adresses );
CREATE TABLE TEACHER ( teacher_id int NOT NULL, first_name VARCHAR(20) NOT NULL, middle_name VARCHAR(20) NOT NULL, last_name VARCHAR(20) NOT NULL, phone_number int NOT NULL, address VARCHAR(20) NOT NULL, school_id int, PRIMARY KEY(teacher_id), FOREIGN KEY(school_id) references schools );
note: when writing the word exa please write exame chegg deos not accept posting the question with the word exame for some reason thank you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
