
Concept explainers
CREATING TABLES USING oracle APEX
CREATE TABLE DEPT (
DEPTNO NUMBER(10) NOT NULL,
DNAME VARCHAR2(50) NOT NULL,
LOC VARCHAR2(50),
CONSTRAINT DEPT_PK PRIMARY KEY (DEPTNO)
);
- NOTNULL constraint is used it represents cell should not be empty
- Here NUMBER AND VARCHAR are data types
Now create emp table
CREATE TABLE EMP(
EMPNO NUMBER(10) NOT NULL,
ENAME VARCHAR2(50) NOT NULL,
JOB VARCHAR2(50),
MGR VARCHAR2(50),
HIREDATE DATE,
SAL NUMBER(6),
DEPTNO NUMBER(10) NOT NULL,
CONSTRAINT EMP_PK PRIMARY KEY
(EMPNO),
CONSTRAINT EMP_FK FOREIGN KEY (
DEPTNO) REFERENCES DEPT (DEPTNO)
);
- oracle consists of standard DATE formats we have to use that
-
PRIMARY KEY is used to uniquely identify records from the table
-
FOREIGN KEY is used to establish the connection between any two tables
- Here DEPT is a resultant table of EMP table
Now SALGRADE TABLE
CREATE TABLE SALGRADE (
GRADE NUMBER (10) NOT NULL,
LOSAL NUMBER(6),
HISAL NUMBER(6),
CONSTRAINT SALGRADE_PK PRIMARY KEY (GRADE)
);
- Combination of unique and not-null constraints we get primary key constraint
After setting up all relations, you need to apply following queries to get data from given
relations: (Write queries and also paste screenshots in answer file)
i. Display the employee id, name, salary, commissioned salary (incremented salary +
commission) with label "Commissioned_Salary".
ii. Write a query that displays the sum of all salaries of each job.
iii. Get the average of clerks salaries.

Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 4 images

- For this problem create a (temporary) table called instructor_course_nums. Write a procedure that accepts an instructor ID as input. The procedure calculates the total number of course sections taught by that instructor, and adds a tuple to the temporary table consisting of the instructors ID number, name, and total courses taught - call these attributes: ID, name, and tot_courses. If the instructor already has an entry in the table,then the procedure makes sure the total number of courses taught in the temporary table is up-to-date. You must name your procedure: Written in PostgreSQLarrow_forwardTo obtain the structure of an Oracle table, the command to use is: a) STRUCTURE [TableName]. b) DESCRIBE [TableName]. c) DESCRIBE STRUCTURE [TableName]. d) DESC TABLE [TableName].arrow_forwarduse oracle sql developper or Oracle sql developper problem in picture the database CREATE TABLE MEMBERSHIP( MEM_NUM CHAR(3) CONSTRAINT MEMBER_MEM_NUM_PK PRIMARY KEY,MEM_FNAME VARCHAR(30) NOT NULL,MEM_LNAME VARCHAR(30) NOT NULL,MEM_STREET VARCHAR(15),MEM_CITY VARCHAR(10),MEM_STATE CHAR(2),MEM_ZIP CHAR(5),MEM_BALANCE NUMBER (2)); ALTER TABLE MEMBERSHIPMODIFY MEM_STREET VARCHAR(25);CREATE TABLE RENTAL( RENT_NUM CHAR(4) CONSTRAINT RENTAL_RENT_NUM_PK PRIMARY KEY,RENT_DATE DATE,MEM_NUM CHAR(3),CONSTRAINT RENTAL_MEM_NUM_FK FOREIGN KEY (MEM_NUM) REFERENCES MEMBERSHIP); CREATE TABLE PRICE(PRICE_CODE CHAR(1) CONSTRAINT PRICE_PRICE_CODE_PK PRIMARY KEY,PRICE_DESC VARCHAR(20),PRICE_RENTFEE NUMBER (3,1),PRICE_DAILYATFEE NUMBER(3,1)); CREATE TABLE MOVIE(MOVIE_NUM CHAR(4) CONSTRAINT MOVIE_MOVIE_NUM_PK PRIMARY KEY,MOVIE_NAME VARCHAR(30) NOT NULL,MOVIE_YEAR CHAR(4),MOVIE_COST NUMBER(5,2),MOVIE_GENRE VARCHAR(15),PRICE_CODE CHAR(1),CONSTRAINT MOVIE_PRICE_CODE_FK FOREIGN KEY (PRICE_CODE) REFERENCES…arrow_forward
- databse programmingarrow_forwardin sql You define a PRIMARY KEY constraint on the EMP_ID column for a table named EMPLOYEES that you created Which actions occur automatically? Select one: a. A CHECK constraint is defined on the EMP_ID column. b.A unique index is created on the EMP_ID column, if one does not already exist c.A trigger is created that will prevent NULL values from being accepted in the EMP_ID column. d. A sequence is created that will generate a unique value in the EMP_ID column for each row that is inserted into the CUSTOMERS table.arrow_forwardPLZ HELP WITH THE FOLLOWING QUESTION Using oralce sql or sql live Create a view named all_volunteer that gets details of all volunteers that assigned tasks in the organization. CREATE TABLE Packinglist( List_ID INT NOT NULL, Name VARCHAR(50), Description VARCHAR(100), PRIMARY KEY(List_ID)); CREATE TABLE Task( Task_Code INT NOT NULL, List_ID INT, Task_Description VARCHAR(100), Type VARCHAR(30), Status VARCHAR(20), PRIMARY KEY(Task_Code), FOREIGN KEY(List_ID) REFERENCES Packinglist(List_ID)); CREATE TABLE Volunteer( Vol_ID INT NOT NULL, Name VARCHAR(50), Telephone NUMBER, Address VARCHAR(100), PRIMARY KEY(Vol_ID)); CREATE TABLE Assignment( Vol_ID INT, Task_Code INT, Start_Time TIME, End_Time TIME, PRIMARY KEY(Vol_ID, Task_Code), FOREIGN KEY(Vol_ID) REFERENCES Volunteer(Vol_ID), FOREIGN KEY(Task_Code) REFERENCES Task(Task_Code)); CREATE TABLE Package( Pack_ID INT NOT NULL, Task_Code INT, Date DATE, Weight FLOAT, PRIMARY…arrow_forward
- Hi triggers Update and using Xampp and this table: CREATE TABLE MEMBER(STUDENT_ID CHAR(6) NOT NULL,CLUB_CODE VARCHAR(4) NOT NULL,MEMBER_DATE DATE NOT NULL,MEMBER_POSITION VARCHAR(15) NOT NULL,MEMBER_ATTENDANCE CHAR(2) NOT NULL,PRIMARY KEY (STUDENT_ID,CLUB_CODE),FOREIGN KEY (STUDENT_ID) REFERENCES STUDENT (STUDENT_ID) ON DELETE RESTRICT ON UPDATE CASCADE,FOREIGN KEY (CLUB_CODE) REFERENCES CLUB (CLUB_CODE) ON DELETE RESTRICT ON UPDATE CASCADE); INSERT INTO MEMBER VALUES('100027','C201','2020-03-25','Secretary','12'),('100027','C202','2020-04-11','Member','11'),('100032','C201','2020-02-23','President','12'),('100050','C201','2020-03-25','Member','10'),('100132','C202','2020-04-11','Treasurer','10'),('100074','C203','2020-04-09','President','12'),('100074','C204','2020-04-25','Treasurer','12'),('100051','C204','2020-04-25','Member','9'),('100064','C207','2020-04-25','Vice…arrow_forwardHere we have Creating table code according to syntax in Oracle APEX. CREATE TABLE DEPT ( DEPTNO NUMBER(10) NOT NULL, DNAME VARCHAR2(50) NOT NULL, LOC VARCHAR2(50) , CONSTRAINT DEPT_PK PRIMARY KEY (DEPTNO) ); Step 2: Emp table CREATE TABLE EMP( EMPNO NUMBER(10) NOT NULL, ENAME VARCHAR2(50) NOT NULL, JOB VARCHAR2(50) , MGR VARCHAR2(50) , HIREDATE DATE, SAL NUMBER(5) , COMM VARCHAR2(50) , DEPTNO NUMBER(10) NOT NULL, CONSTRAINT EMP_PK PRIMARY KEY (EMPNO), CONSTRAINT EMP_FK FOREIGN KEY ( DEPTNO ) REFERENCES DEPT (DEPTNO ) ); Step 3 CREATE TABLE SALGRADE ( GRADE NUMBER(10) NOT NULL, LOSAL NUMBER(10) , HISAL NUMBER(10) , CONSTRAINT SALGRADE_PK PRIMARY KEY (GRADE) ); Question: Give all employees records who have salaries in between 1000 and 2000 (both included)Get all employee names whose name the second letter is ‘A’.Retrieve all employees records who don’t take a commission.Get all employee's records who work as ‘CLERK’.arrow_forwardTask Write a query to retrieve the records of students who have their total marks greater than or equal to 500 Total marks refer to the sum of the marks of a single student. The result should be in the following format • STUDENT ID • SUM OF MARKS The result should be sorted in descending order by STUDENT D Table description Table: marks Name STUDENT_ID Type Description INTEGER This is the student's unique ID These are the marks obtained STUDENT MARKS INTEGERarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





