Oracle
Description: ORACLE Practice, ORACLE Certification Questions | |
Number of Questions: 20 | |
Created by: Arav Srivastava | |
Tags: ORACLE Practice ORACLE Certification Questions Oracle |
Find the odd man out.
- PRIMARY KEY Constraint
- UNIQUE KEY Constraint
- CHECK Constraint
- FOREIGN KEY Constraint
- NOT NULL Constraint Note: While finding the odd man out from the above choices, consider the general scenarios, ignore the rare scenario.
Which of the following requires the usage of wild card characters?
Which of the following is TRUE about PRIMARY KEY Constraint
- A Table can have more than one primary key.
- PRIMARY KEY should be defined along with the creation of the Table.
- PRIMARY KEY can be added after creating the Table using ALTER .
- PRIMARY KEY can also be dropped in case it is not useful.
- To define a PRIMARY KEY on any column, the column should ensure not to contain any NULL values.
Which of the following is the correct way of defining the CHECK constraint?
Which of the following is not the valid type of JOIN in ORACLE.
A. INNER JOIN B. LEFT and RIGHT JOINS C. SELF JOIN D. MIDDLE JOIN
Which of the following can produces the NULL values in the resultant tables? Note: The source tables have no NULL values in them.
A. INNER JOIN B. LEFT & RIGHT JOINS C. SELF JOIN
Which of the following is the correct way of defining a DEFAULT constraint for a table?
Assume there are 20 rows in the STUDENTS table and 5 rows in BRANCH table. Take a look at the Query below.
STUDENT Table has columns - STUDENT_ID, STUDENT_NAME, BR_ID, AGE, MARKS BRANCH Table has columns - BRANCH_ID, BRANCH_NAME
SELECT STUDENT_ID, STUDENT_NAME, BRANCH_ID, BRANCH_NAME FROM STUDENTS, BRANCH
What is the name of the join used in the above Query.
Assume there are 20 rows in the STUDENTS table and 5 rows in BRANCH table. Take a look at the Query below.
STUDENT Table has columns - STUDENT_ID, STUDENT_NAME, BR_ID, AGE, MARKS BRANCH Table has columns - BRANCH_ID, BRANCH_NAME
SELECT STUDENT_ID, STUDENT_NAME, BRANCH_ID, BRANCH_NAME FROM STUDENTS, BRANCH
How many number of rows does the above query results?
Write the missing code for the Foreign Key constraint definition. Missing code is represented by *************** below.
Hint: Foreign Key is to define for BID column in STUDENTS table on BRANCH_ID column in BRANCH table.
CREATE TABLE BRANCH(
BRANCH_ID INT NOT NULL,
BRANCH_NAME VARCHAR2(20) NOT NULL,
PRIMARY KEY (BRANCH_ID) );
CREATE TABLE STUDENTS(
STUDENT_ID INT NOT NULL,
STUDENT_NAME VARCHAR2(25) NOT NULL,
AGE INT NOT NULL,
ADDRESS VARCHAR2(25) ,
MARKS INT,
BID INT *********************,
PRIMARY KEY (STUDENT_ID) );
Write a query to enable (or TURN ON) a constraint on a table.
How do you represent the missing values in a table in ORACLE?
Which of the following is correct about NOT NULL constraint?
A. NOT NULL constraint demands a column not to accept NULL values. B. NOT NULL constraint demands a field to always contains some value. C. One cannot insert a new record with a NULL value, when NOT NULL constraint is specified.
Which of the following are correct about the Constraints?
Write a query to retrieve all the students details whose id's starting from 1001 to 1050.
Which of the following the correct way of defining the PRIMARY KEY constraint for a STUDENT table
A. CREATE TABLE STUDENTS(
ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR (25) ,
MARKS INT,
PRIMARY KEY (ID)
);
B. CREATE TABLE STUDENTS(
ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR (25) ,
MARKS INT,
PRIMARY KEY (ID, NAME)
);
C. CREATE TABLE STUDENTS(
ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR (25) ,
MARKS INT,
);
ALTER TABLE STUDENTS ADD CONSTRAINT PK_STUDENTID PRIMARY KEY (ID, NAME);
D. CREATE TABLE STUDENTS(
ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR (25) ,
MARKS INT,
);
ALTER TABLE STUDENTS ADD CONSTRAINT PK_STUDENTID PRIMARY KEY (ID);
Consider the data from the two table STUDENT and BRANCH below.
STUDENT_ID | STUDENT_NAME | BR_ID | MARKS |
1001 | STUDENT1 | 101 | 79 |
1002 | STUDENT 2 | 102 | 92 |
1003 | STUDENT 3 | 101 | 78 |
1004 | STUDENT 4 | 102 | 69 |
1005 | STUDENT 5 | 103 | 90 |
1006 | STUDENT 6 | 104 | 87 |
1007 | STUDENT 7 | 103 | 93 |
1008 | STUDENT 8 | 102 | 89 |
1009 | STUDENT 9 | 105 | 78 |
1010 | STUDENT 10 | 106 | 76 |
BRANCH_ID | BRANCH_NAME |
101 | COMPUTERS |
102 | ARTS |
103 | ELECTRONICS |
104 | CHEMICAL |
105 | MECHANICAL |
Write a query to retrieve the STUDENT_ID, STUDENT_NAME, STUDENT_NAME, BRANCH_ID, BRANCH_NAME and MARKS by joining the table STUDENTS and BRANCH on BRANCH_ID column.
Consider the AGENTS table with columns AGENT_ID, AGENT_NAME, SALARY, SALES_QTY, Commission_Paid
Write a query to display the agents details whose agents Commission_Paid is not equal to NULL.
Consider the data from the two table STUDENT and BRANCH below.
STUDENT_ID | STUDENT_NAME | BR_ID | MARKS |
1001 | STUDENT1 | 101 | 79 |
1002 | STUDENT 2 | 102 | 92 |
1003 | STUDENT 3 | 101 | 78 |
1004 | STUDENT 4 | 102 | 69 |
1005 | STUDENT 5 | 103 | 90 |
1006 | STUDENT 6 | 104 | 87 |
1007 | STUDENT 7 | 103 | 93 |
1008 | STUDENT 8 | 102 | 89 |
1009 | STUDENT 9 | 105 | 78 |
1010 | STUDENT 10 | 106 | 76 |
BRANCH_ID | BRANCH_NAME |
101 | COMPUTERS |
102 | ARTS |
103 | ELECTRONICS |
104 | CHEMICAL |
105 | MECHANICAL |
Write a query to retrieve the STUDENT_ID, STUDENT_NAME, STUDENT_NAME, BRANCH_ID, BRANCH_NAME and MARKS by joining the table STUDENTS and BRANCH on BRANCH_ID column. Also ensure that each row in the STUDENTS table should be present in the result table.
Consider the data from the two table STUDENT and BRANCH below.
STUDENT_ID | STUDENT_NAME | BR_ID | MARKS |
1001 | STUDENT1 | 101 | 79 |
1002 | STUDENT 2 | 102 | 92 |
1003 | STUDENT 3 | 101 | 78 |
1004 | STUDENT 4 | 102 | 69 |
1005 | STUDENT 5 | 103 | 90 |
1006 | STUDENT 6 | 104 | 87 |
1007 | STUDENT 7 | 103 | 93 |
1008 | STUDENT 8 | 102 | 89 |
1009 | STUDENT 9 | 105 | 78 |
1010 | STUDENT 10 | 106 | 76 |
BRANCH_ID | BRANCH_NAME |
101 | COMPUTERS |
102 | ARTS |
103 | ELECTRONICS |
104 | CHEMICAL |
105 | MECHANICAL |
Predict the output of the following query.
SELECT STUDENT_ID, STUDENT_NAME, BRANCH_ID, BRANCH_NAME, MARKS FROM STUDENTS LEFT JOIN BRANCH ON BR_ID = BRANCH_ID