Extended Clause Flashcards
Write a query to display employee_ID, first_name, last_name, salary from employees table where salary is greater than 6000
Select employee_ID, first_name, last_name, salary from employees; where salary>6000
Write a query to display employee_ID, first_name, last_name, department_ID, salary where salary is greater than 7000 and department_ID is equal to 90
Select employee_ID, first_name, last_name, department_ID, salary where salary > 7000 AND department_ID = 90;
Write a query to display employee_ID, first_name, last_name, department_ID, salary where salary is greater than 7000 or department_ID = 90;
Select employee_ID, first_name, last_name, salary, department_ID
from employees
Where salary > 7000 OR department_ID = 90;
Write a query to display all records from employees table where department_ID is between 30 to 90
Select * from employees
where Department_ID Between 30 and 90;
Write a query to display employee_ID , first_name, last_name, salary, department_ID from employees where department_ID is 30 or 60 or 90
Select employee_ID, first_name, last_name, salary, department_ID
from employees
Where department_ID IN(30,60,90);
Write a query to display employee_ID, first_name, last_name in uppercase, salary from employees table
Select employee_ID, first_name, UPPER(last_name) AS last_name, salary from employees;
Write a query to display all columns and last_name in uppercase from employees table
Select *, upper(last_name) AS upper_last_name
from employees;
Write a query to display all records from employees table where the first_name starts with A
Select * from employees
where first_name like ‘A%’;
Write a query to display all records from employees table where the first_name ends with A
Select * from employees
where first_name like ‘%A’;
Write a Query to create a table EMP_YOURNAME where we have three columns EMP_ID that having int datatype, NAME that having varchar2 datatype and length size is 25, AGE having number datatype that having 3 length size
Create a table EMP_Mukul (EMP_Parth INT
NAME VARCHAR2(25),
AGE NUMBER(3));
Write a query to add a extra column in EMP_Parth table, the column is JOB_ID that having varchar2 datatype and length size is 30
Alter table EMP_Parth
ADD JOB_ID varchar2(30);
Write a query to drop AGE column from EMP_Parth table
Alter table EMP_Parth
Drop Column_AGE
Write a query to rename JOB_ID column to POST_ID from EMP_Parth
Alter table EMP_Parth
Rename column JOB_ID to POST_ID;
What is primary key constraint ?
contains unique values and can’t contain NULL values
What is an example of primary key ?
Create Table Student_Parth( STD_ID int primary key,
NAME varchar2(30) NULL,
Mobile_Number number(10)
UNIQUE
Salary number (10,2);