COUNTRIES(COUNTRY_ID, COUNTRY_NAME, REGION_ID)
LOCATIONS(LOCATION_ID, STREET_ADDRESS, POSTAL_CODE, CITY,STATE_PROVINCE, COUNTRY_ID)
DEPARTMENTS(DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID,LOCATION_ID)
EMPLOYEES(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB_ID, SALARY, COMMISSION_PCT, MANAGER_ID, DEPARTMENT_ID)
JOB_HISTORY(EMPLOYEE_ID, START_DATE, END_DATE, JOB_ID, DEPARTMENT_ID)
JOBS(JOB_ID, JOB_TITLE, MIN_SALARY, MAX_SALARY)
Question A: For each employee print last name, salary, and job title. Continue reading “SQL Practice | Day 4”
Member(mid, mname, email, address)
Books(bid, bname, yearOfPublication, publisher)
Borrows(mid, bid, date)
Question1: Find the name of the books either published before 1980 or are “Computer” related. (i.e. have “Computer” in their names).
Continue reading “SQL Practice | Day 3”
A. Find the last names of all employess that work in SALES department.
SELECT substring(FullName,charindex(' ',FullName)+1,len(FullName)) as LastName
WHERE dept_id = (SELECT dept_id
WHERE name = "SALES" ) );
Continue reading “SQL Query | Day 2”
Courses(cid, cname, fid)
Takes(sid, cid, year, CGPA)
**Find the no. of courses taken per year by each student.
SELECT sid, COUNT(cid), year
GROUP BY sid, year;
Continue reading “SQL Query Practice | Day 1”