You are on page 1of 9

Question #1

Which number should come next in this series?


1, 3, 2, 6, 5, 11, 10,?
Correct Answer: Write here

Question #2
You are given an Online ProductMarketing Table. You need to convert the Date-Time
format to Date Format as
DateChanged.
Also, get the product category which was browsed by Women
ProductMarketing
session_id DateTime user_id product campaign_id webpage_id product_category
gender
140690 2017-07-02
00:00 858557 C 359520 13787 4 Female
333291 2017-07-02
00:00 243253 C 105960 11085 5 Female
Coding Language: SQLite

Candidate Code:
update ProductMarketing
set DateTime = todate()
select product
from ProductMarketing
where gender = 'Female';
Compilation Summary:
Compilation Status: Compile Successfully No Of Compilations: 2
Defualt Input:
CREATE TABLE ProductMarketing(<br> session_id INTEGER NO
T NULL PRIMARY KEY <br> ,DateTime VARCHAR(16) NOT NULL<b
r> ,user_id INTEGER NOT NULL<br> ,product VARCHAR(1)
NOT NULL<br> ,campaign_id INTEGER NOT NULL<br> ,webpag
e_id INTEGER NOT NULL<br> ,product_category INTEGER NOT
NULL<br> ,gender VARCHAR(6) NOT NULL<br>);
<br>INSERT INTO ProductMarketing(session_id,DateTime,user_id,
product,campaign_id,webpage_id,product_category,gender) V
ALUES (140690,'2017-07-02 00...

Candidate Output:
SQL error: near "select": syntax error<br>
Test Case Summary:
Test Case: 1 Status: Fail Score:0
Answer:
QUESTION DETAILS
Page 2/8
Test Case Input Expected Output
CREATE TABLE ProductMarketing(
session_id INTEGER NOT NULL PRIMARY KEY
,DateTime VARCHAR(16) NOT NULL
,user_id INTEGER NOT NULL
,product VARCHAR(1) NOT NULL
,campaign_id INTEGER NOT NULL
,webpage_id INTEGER NOT NULL
,product_category INTEGER NOT NULL
,gender VARCHAR(6) NOT NULL
);
INSERT INTO
ProductMarketing(session_id,DateTime,user_id,product,campaign_id,webpage_id,pro
duct_category,gender) VALUES (140690,'2017-
07-02 00...
2927,2017-07-
02,295456,I,404347
490038,2017-07-
02,802278,H,359520
140690,2017-07-
02,858557,C,359520
333291,2017-07-
02,243253,C,105960
Question: #3 Type: Coding Skill: SQLite Status: Answered Result: Wrong
Level: Easy Time Taken: 7 min 19 sec Score: 0 / 5 Window Violation: 0 times Time
Violation: 0 sec

Question #3
Write an SQL query to display the extension of the Employee along with the complete
address as Complete_Address.
Note: The output needs to be in the correct format
employees
employeeNumber lastName firstName extension email officeCode reportsTo jobTitle
1002 Murphy Diane x5800 dmurphy@classicmodelcars.com 1 null President
1056 Patterson Mary x4611 mpatterso@classicmodelcars.com 1 1002 VP Sales
1076 Firrelli Jeff x9273 jfirrelli@classicmodelcars.com 1 1002 VP
Marketing
1088 Patterson William x4871 wpatterson@classicmodelcars.com 6 1056
Sales
Manager
(APAC)
offices
officeCode city phone addressLine1 addressLine2 state country postalCode territory
1 San
Francisco +1 650 219 4782 100 Market Street Suite 300 CA USA 94080 NA
2 Boston +1 215 837 0825 1550 Court Place Suite 102 MA USA 2107 NA
3 NYC +1 212 555 3000 523 East 53rd
Street apt. 5A NY USA 10022 NA
Coding Language: SQLite
Candidate Code:
select concat(o.addressline1,o.addressline2,e.extension)
from employees e
inner join offices o
on e.officecode = o.officecode;
Compilation Summary:
Compilation Status: Compile Successfully No Of Compilations: 3
Defualt Input:
CREATE TABLE employees(<br> employeeNumber INTEGER NOT
NULL PRIMARY KEY <br> ,lastName VARCHAR(9) NOT NULL<br> ,f
irstName VARCHAR(8) NOT NULL<br> ,extension VARCHAR(5)
NOT NULL<br> ,email VARCHAR(31) NOT NULL<br> ,officeCod
e INTEGER NOT NULL<br> ,reportsTo INTEGER <br> ,jobTitle
VARCHAR(20) NOT NULL<br>);
<br>INSERT INTO employees(employeeNumber,lastName,firstNa
me,extension,email,officeCode,reportsTo,jobTitle) VALUES (1002,'
Murphy','Diane','x5800','dmurphy@classicmodelcars.co...
Candidate Output:
SQL error: no such function: concatenate<br>
Test Case Summary:
Test Case: 1 Status: Fail Score:0
Answer:
Page 3/8
Test Case Input
CREATE TABLE employees(
employeeNumber INTEGER NOT NULL PRIMARY KEY
,lastName VARCHAR(9) NOT NULL
,firstName VARCHAR(8) NOT NULL
,extension VARCHAR(5) NOT NULL
,email VARCHAR(31) NOT NULL
,officeCode INTEGER NOT NULL
,reportsTo INTEGER
,jobTitle VARCHAR(20) NOT NULL
);
INSERT INTO
employees(employeeNumber,lastName,firstName,extension,email,officeCode,reports
To,jobTitle) VALUES (1002,'Murphy','Diane','x5800','dmurphy@classicm
Question: #4 Type: Coding Skill: SQLite Status: Answered Result: Correct
Level: Easy Time Taken: 2 min 18 sec Score: 5 / 5 Window Violation: 0 times Time
Violation: 0 sec
Question #4
Display the names of all the Students with their respective departments.
Students
StudentId StudentName DepartmentId DateOfBirth
1 Michael 1 1998-10-12
5 Sally 2 1998-10-12
7 Adam 3 1998-10-12
9 Bob 3 1998-10-12
10 Ron 1 1998-10-12
Department
DepartmentId DepartmentName
1 IT
2 Physics
3 Arts
Coding Language: SQLite
Candidate Code:
select StudentName,DepartmentName
from Students s
inner join department d
on s.departmentid = d.departmentid;
Compilation Summary:
Compilation Status: Compile Successfully No Of Compilations: 1
Defualt Input:
CREATE TABLE Students(<br> StudentId VARCHAR(9) NOT NULL P
RIMARY KEY<br> ,StudentName VARCHAR(11) NOT NULL<br> ,Depar
tmentId VARCHAR(12) NOT NULL<br> ,DateOfBirth VARCHAR(11) NO
T NULL<br>);
<br>INSERT INTO Students(StudentId,StudentName,DepartmentId,
DateOfBirth) VALUES ('1','Michael','1','12-10-98');
<br>INSERT INTO Students(StudentId,StudentName,DepartmentId,
DateOfBirth) VALUES ('2','John','1','12-10-98');
<br>INSERT INTO Students(StudentId,StudentName,DepartmentId,
DateOfBirth) VALUES ('3','Jack','1','12-10-98'...
Candidate Output:
Michael,IT<br>John,IT<br>Jack,IT<br>Sara,Physics<br>Sally,Physics
<br>Nancy,Physics<br>Adam,Arts<br>Stevens,Arts<br>Bob,Arts<br
>Ron,IT<br>Alexander,Physics<br>
Test Case Summary:
Test Case: 1 Status: Pass Score:5
Test Case Input Expected Output Actual
Output
Answer:
Page 4/8
Test Case Input Expected Output Actual
Output
CREATE TABLE Students(
StudentId VARCHAR(9) NOT NULL PRIMARY KEY
,StudentName VARCHAR(11) NOT NULL
,DepartmentId VARCHAR(12) NOT NULL
,DateOfBirth VARCHAR(11) NOT NULL
);
INSERT INTO Students(StudentId,StudentName,DepartmentId,DateOfBirth) VALUES
('1','Michael','1','12-
10-98');
INSERT INTO Students(StudentId,StudentName,DepartmentId,DateOfBirth) VALUES
('2','John','1','12-
10-98');
INSERT INTO Students(StudentId,StudentName,DepartmentId,DateOfBirth) VALUES
('3','Jack','1','12-
10-98'...
Michael,IT
John,IT
Jack,IT
Sara,Physics
Sally,Physics
Nancy,Physics
Adam,Arts
Stevens,Arts
Bob,Arts
Ron,IT
Alexander,Physics
Pass

Question: #5 Type: Coding Skill: SQLite Status: Answered Result: Correct


Level: Easy Time Taken: 4 min 20 sec Score: 5 / 5 Window Violation: 0 times Time
Violation: 0 sec
Question #5
Generate a report that contains the name of the department and the number of
Employees it contains. The report
should contain only the name of the department that contains two employees.
Employee
Emp_ID First_Name Last_Name Salary Joining_Date DepartmentId
101 John Carter 500000 14-02-20 1
102 Alex Wasabi 80000 14-06-11 2
103 Lilly Kholes 300000 14-02-20 1
104 Collin Whales 500000 14-02-20 2
105 Clement Paul 500000 14-06-11 2
Departments
DepartmentId DepartmentName
1 Admin
2 HR
3 Accounts
Coding Language: SQLite
Candidate Code:
SELECT d.DepartmentName,count(*)
from Departments d
inner join Employee e
on d.DepartmentId = e.DepartmentId
group by d.DepartmentId
having count(*) = 2;
Compilation Summary:
Compilation Status: Compile Successfully No Of Compilations: 4
Defualt Input:
CREATE TABLE Employee(<br> Emp_ID INTEGER NOT NULL PRIM
ARY KEY <br> ,First_Name VARCHAR(7) NOT NULL<br> ,Last_Nam
e VARCHAR(7) NOT NULL<br> ,Salary INTEGER NOT NULL<br> ,
Joining_Date DATE NOT NULL<br> ,DepartmentId INTEGER NOT N
ULL<br>);
<br>INSERT INTO Employee(Emp_ID,First_Name,Last_Name,Salary
,Joining_Date,DepartmentId) VALUES (101,'John','Carter',500000,'2
0-02-14',1);
<br>INSERT INTO Employee(Emp_ID,First_Name,Last_Name,Salary
,Joining_Date,DepartmentId) VALUES (102,'Alex','Wasabi',80000,'11
-06...
Candidate Output:
Accounts,2<br>
Test Case Summary:
Answer:
Page 5/8
Test Case: 1 Status: Pass Score:5
Test Case Input Expected
Output
Actual
Output
CREATE TABLE Employee(
Emp_ID INTEGER NOT NULL PRIMARY KEY
,First_Name VARCHAR(7) NOT NULL
,Last_Name VARCHAR(7) NOT NULL
,Salary INTEGER NOT NULL
,Joining_Date DATE NOT NULL
,DepartmentId INTEGER NOT NULL
);
INSERT INTO
Employee(Emp_ID,First_Name,Last_Name,Salary,Joining_Date,DepartmentId) VALUES
(101,'John','Carter',500000,'20-
02-14',1);
INSERT INTO
Employee(Emp_ID,First_Name,Last_Name,Salary,Joining_Date,DepartmentId) VALUES
(102,'Alex','Wasabi',80000,'11-
06...
Accounts,2 Pass
Question: #6 Type: Coding Skill: SQLite Status: Answered Result: Wrong
Level: Easy Time Taken: 4 min 21 sec Score: 0 / 5 Window Violation: 0 times Time
Violation: 0 sec

Question #6
Select departments which have at least three students in it and display students count
and the name of the students in
the specific department separated by commas
Generate a report that contains the name of the department, number of students and
the name of students separated
by commas. The report should contain the names of the department that contain at
least three employees.
Employee
Emp_ID First_Name Last_Name Salary Joining_Date DepartmentId
101 John Carter 500000 14-02-20 1
102 Alex Wasabi 80000 14-06-11 2
103 Lilly Kholes 300000 14-02-20 1
104 Collin Whales 500000 14-02-20 2
105 Clement Paul 500000 14-06-11 2
Departments
DepartmentId DepartmentName
1 Admin
2 HR
3 Accounts
Coding Language: SQLite
Candidate Code:
select d.departmentname as name of department,count(*),last_name
from departments d
join employee e
on d.departmentid = e.departmentid
group by departmentid
having count(*)>3;
Compilation Summary:
Compilation Status: No Of Compilations: 0
Defualt Input: Candidate Output:
Test Case Summary:
Test Case: 1 Status: Fail Score:0
Test Case Input Expected Output Actual
Output
Answer:
Page 6/8
Test Case Input Expected Output Actual
Output
CREATE TABLE Employee(
Emp_ID INTEGER NOT NULL PRIMARY KEY
,First_Name VARCHAR(7) NOT NULL
,Last_Name VARCHAR(7) NOT NULL
,Salary INTEGER NOT NULL
,Joining_Date DATE NOT NULL
,DepartmentId INTEGER NOT NULL
);
INSERT INTO
Employee(Emp_ID,First_Name,Last_Name,Salary,Joining_Date,DepartmentId) VALUES
(101,'John','Carter',500000,'20-
02-14',1);
INSERT INTO
Employee(Emp_ID,First_Name,Last_Name,Salary,Joining_Date,DepartmentId) VALUES
(102,'Alex','Wasabi',80000,'11-
06...
Admin,3,John, Lilly, Tana
HR,3,Alex, Collin, Clement Fail
Question: #7 Type: Coding Skill: SQLite Status: Answered Result: Correct
Level: Easy Time Taken: 3 min 23 sec Score: 5 / 5 Window Violation: 0 times Time
Violation: 0 sec

Question #7
Find the name of customers who live in Bangalore and have ordered a product with a
total cost of more than 100. (Total
cost = Price + Shipping)
Orders
ProductId CustomerId Price(INR) Shipping(INR)
1001 101 10 50
1002 102 20 30
1003 103 30 40
Products
ProductId Weight(in gms) CustomerId
1001 100 101
1002 200 102
1003 120 103
Customers
CustomerId CustomerName City
101 Jack Bangalore
102 Ram Mangalore
103 Jones Mumbai
Coding Language: SQLite
Candidate Code:
select customername
from customers c
join orders o
on c.customerid = o.customerid
join products p
on p.productid = o.productid
where c.city = 'Bangalore'
and price+shipping > 100;
Compilation Summary:
Compilation Status: Compile Successfully No Of Compilations: 1
Answer:
Page 7/8
Defualt Input:
CREATE TABLE Orders(<br> ProductId INTEGER NOT NULL PRIMARY
KEY <br> ,CustomerId INTEGER NOT NULL<br> ,Price INTEGER N
OT NULL<br> ,Shipping INTEGER NOT NULL<br>);
<br>INSERT INTO Orders(ProductId,CustomerId,Price,Shipping) VA
LUES (1001,101,10,50);
<br>INSERT INTO Orders(ProductId,CustomerId,Price,Shipping) VA
LUES (1002,102,20,30);
<br>INSERT INTO Orders(ProductId,CustomerId,Price,Shipping) VA
LUES (1003,103,30,40);
<br>INSERT INTO Orders(ProductId,CustomerId,Price,Shipping) VA
LUES (1004,104,40,30);<br>INSERT INTO...
Candidate Output:
Jacob<br>
Test Case Summary:
Test Case: 1 Status: Pass Score:5
Test Case Input Expected Output Actual Output
CREATE TABLE Orders(
ProductId INTEGER NOT NULL PRIMARY KEY
,CustomerId INTEGER NOT NULL
,Price INTEGER NOT NULL
,Shipping INTEGER NOT NULL
);
INSERT INTO Orders(ProductId,CustomerId,Price,Shipping) VALUES (1001,101,10,50);
INSERT INTO Orders(ProductId,CustomerId,Price,Shipping) VALUES (1002,102,20,30);
INSERT INTO Orders(ProductId,CustomerId,Price,Shipping) VALUES (1003,103,30,40);
INSERT INTO Orders(ProductId,CustomerId,Price,Shipping) VALUES (1004,104,40,30);
INSERT INTO...
Jacob Pass
Page

You might also like