Question : Write MS-SQL Server Script for : (check for null at all times)
1) Select all ManagerIDas SupervisorNumber from table EmpJob (if managerID is null, do not include in the output)
Table name : EmpJob
Available Data :
ManagerID
553434
NULL
2134323
324343
Expected output :
Supervisor Number
553434
2134323
324343
2) Select name (attribute) the as branch(new col name) from table FoLocation (check for null. If null no data in the output)
table name : FoLocation
Available Data :
name
Toronto
Missisauga
San Fransisco
Expected Output :
Branch
Toronto
Missisauga
San Fransisco
3) Select defaultJobLevel as Sup/Mgr(new col name) from table JobCode
table Name : JobCode
Available Data :
defaultJobLevel
Associate
IT
IT
Manager
Supervisor
Manager
IT
Expected Output :
No
No
No
Yes
Yes
Yes
No
4) Select EmployeeType (attribute) as PersonType(new col name) from table EmpJob
table name : EmpJob
Available Data : (needs to map these number code to the different type of employee)
EmployeeType (attribute)
814
72250
72249
72248
72251
72248
Expected Output :
PersonType (new col name)
Agency
Consultant
Contract
Co-op
Employee
Co-op
5) Select emplstatus(attribute) as Status(new col name) from EmpJob
table name : EmpJob
available data :
emplstatus
802
802
801
800
810
811
812
Expected Output :
Active Assignment
Active Assignment
FMLA
LTD
STD
STD Paid 100
unpaid
6) Select CustomString18 (attribute) as workathome from table EmpJob
Table Name : EmpJob
Available Data :
CustomString18
NULL
NULL
500
500
NULL
Expected Output :
N
N
Y
Y
N
7) Select CostCenter as Division from EmpJob
table Name : EmpJob
Available Data : (take first 3 digits from Cost Center)
CostCenter
100907623473
200348329843
10002323243
10034343443
200543534533
Expected Output :
Division
100
200
100
100
200
8) Select name (attribute) as Territory (new col name) from table FoCostCenter
table name : FoCostCenter
available data : (separate all the name and select the third as output)
name
100.234.234324.45654.546546.12334.F
100.34543.3454353.3243.45643.43543.F
Expected output :
Territory
234324
3454353
9) Select name (attribute) as Department (new col name) from table FoCostCenter
table name : FoCostCenter
available data : (separate all the name and select the second as output)
name
100.234.234324.45654.546546.12334.F
100.34543.3454353.3243.45643.43543.F
expected output :
Department
234
34543
10 ) Select name (attribute) as Category (new col name) from table FoCostCenter
table name : FoCostCenter
available data : (separate all the name and select the fourth as output)
name
100.234.234324.45654.546546.12334.F
100.34543.3454353.3243.45643.43543.F
expected output :
category
45654
3243
11) Select name (attribute) as project (new col name) from table FoCostCenter
table name : FoCostCenter
available data : (separate all the name and select the fifth as output)
name
100.234.234324.45654.546546.12334.F
100.34543.3454353.3243.45643.43543.F
expected output :
project
546546
45643
12 ) Select name (attribute) as vendor (new col name) from table FoCostCenter
table name : FoCostCenter
available data : (separate all the name and select the sixth as output)
name
100.234.234324.45654.546546.12334.F
100.34543.3454353.3243.45643.43543.F
expected output :
vendor
12334
43543
13 ) Select name (attribute) as EmployeeType (new col name) from table FoCostCenter
table name : FoCostCenter
available data : (separate all the name and select the seventh as output)
name
100.234.234324.45654.546546.12334.F
100.34543.3454353.3243.45643.43543.F
expected output :
EmployeeType
F
F
1)
SELECT ManagerID as SupervisorNumber FROM EmpJob WHERE ManagerID IS NOT NULL;
2)
SELECT name AS branch FROM FoLocation WHERE attribute IS NOT NULL;
3)
SELECT CASE
WHEN defaultJobLevel = 'Manager' THEN 'Yes'
WHEN defaultJobLevel = 'Supervisor' THEN 'Yes'
ELSE 'No'
END
AS "Sup/Mgr"
FROM JobCode;
4)
SELECT CASE
WHEN EmployeeType = 814 THEN 'Agency'
WHEN EmployeeType = 72250 THEN 'Consultant'
WHEN EmployeeType = 72249 THEN 'Contract'
WHEN EmployeeType = 72248 THEN 'Co-op'
WHEN EmployeeType = 72251 THEN 'Employee'
END
AS PersonType
FROM EmpJob;
NOTE: As per Chegg policy, I am allowed to answer specific number of questions (including sub-parts) on a single post. Kindly post the remaining questions separately and I will try to answer them. Sorry for the inconvenience caused.
Question : Write MS-SQL Server Script for : (check for null at all times) 1) Select...
write a SQL statements to perform the following: Select all years a World Series game was played Select all losing teams that played in a World Series game Select all winning and losing teams that played in a World Series game Select all cities of a winning or losing team that played in a World Series game Select all winning and losing teams that played in a World Series game, and provide aliases of "Winning Team" and "Losing Team" Select...
* myCompany.SQL Introduction to SQL Script file for ORACLE DBMS This script file creates the following tables: VENDOR, PRODUCT, CUSTOMER, INVOICE, LINE EMPLOYEE and loads the default data rows */ set echo on; set serveroutput on; select systimestamp from dual; show user; ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY'; DROP TABLE LINE CASCADE CONSTRAINTS; DROP TABLE INVOICE CASCADE CONSTRAINTS; DROP TABLE CUSTOMER CASCADE CONSTRAINTS; DROP TABLE PRODUCT CASCADE CONSTRAINTS; DROP TABLE VENDOR CASCADE CONSTRAINTS; DROP TABLE EMPLOYEE CASCADE CONSTRAINTS; CREATE TABLE...
Using SQL, carry out the various DML and DDL functions on the tables mentioned below: 1. Insert the data given above in both employee, department and project tables. 2. Display all the employees’ information. 3. Display Employee name along with his SSN and Supervisor SSN. 4. Display the employee names whose bdate is ’29-MAR-1959’. 5. Display salary of the employees without duplications. 6. Display the MgrSSN, MgrStartDate of the manager of ‘Finance’ department. 7. Modify the department number of an...
QUESTION: (Answer in SQL) Write an SQL query to find all pairs of users (A,B) such that both A and B have blurted on a common topic but A is not following B. Your query should print the names of A and B in that order. BACKGROUND INFO: Users can post their thoughts in form of short messages that we call “blurts”. When signing up, users need to provide their email and a password of their choice. In addition, they...
QUESTION 1 What is the most common relationship within a relational database? Select the best answer from the following. One-To-One relationship. o One-To-Many relationship. Many-To-Many relationship. Zero-To-Zero relationship. QUESTION 2 What is an "entity'? Select the best answer from the following. An entity, for our purposes, is the same as a table in the database. An entity represents one of the columns in an individual table. There are no entities in a relational database. Entities are only part of NoSQL...
1.What is the return value if the user try to do the following: SELECT TRUNC (65.73,-2) FROM DUAL; Select one: a. 60 b. 00 c. 0 d. 600 2.Supposed that the user uses the ff SELECT statement: what will be the possible output. SELECT GRADE AS STUDENT MARK FROM GRADE_REPORT; Select one: a. Error because of the keyword AS. b. Error because of missing “” mark. c. Will display the column GRADE rename as STUDENT MAK d. Will display all...
ules for submission: 1. All problems must be solved using SQL code. The SQL code and the output of your query should be cut and pasted into your MS Word file. a. Output Tables must be screenshot from DBMS b. Do not create a MS Word (or other application) table and paste the results into it. c. With the exception of Problems 4, 5 and 6, all output should be the result of a single step. Do not paste outputs...
database and sql problme THE QUESTIONS 3, 4,5 and 6 REFER TO THE RELATIONAL TABLES LISTED BELOW CREATE TABLE Department ( DECIMAL(5) VARCHAR(30) CHAR(5) DATE NOT NULL NOT NULL NOT NULL * Department number /*Department name * Department manager number */ /Manager start date DNumber DName Manager MSDate CONSTRAINT Department_PK PRIMARY KEY(DNumber) CONSTRAINT Department_CK UNIQUE(DName) CREATE TABLE DeptLocation DECIMAL(5) VARCHAR(50) NOT NULL NOT NULL DNumber * Department number */ * Department location */ Address CONSTRAINT DeptLocation_PK PRIMARY KEY(DNumber, Address) CONSTRAINT...
Question 1.Write a SQL statement for each of the following questions based on the above tables (50 Points). 1) Create “Enrollment” table. 2) Change the credits of “Database” course from 2 to 3. 3) List the course titles (not Course_No) and grades John Doe had taken. 4) Calculate average of Café Balance, and name new field as Average Balance. 5) Create a roster for “Database” course (list student ID, last name, first name, major, and status for each student enrolled...
**** ITS MULTI-PART QUESTION. PLEASE MAKE SURE TO ANSWER THEM ALL. SOLVE IT BY JAVA. **** *** ALSO MAKE SURE IT PASS THE TESTER FILE PLEASE*** Often when we are running a program, it will have a number of configuration options which tweak its behavior while it's running. Allow text completion? Collect anonymous usage data? These are all options our programs may use. We can store these options in an array and pass it to the program. In its simplest...