Assessment test for a small company
Anonymous User
471

I passed the phone interview for a small company I'm applying for. They sent an assessment test to test my SQL and Python. I feel confident in SQL, but python not so much. Can anyone help with the assessment test? I want to see if my answers are correct compared to the answers I get here.

Refer to the following Data model for Questions 1-5
image

  1. Write SQL Query to list all the Sales for the state of California in the year 2018

  2. Write SQL query to list Sales amount for each department in the year 2018 sorted by the sales amount (Show all the department even if it did not make any sales)

  3. Write SQL to list all the salesman who did not make any sales in 2018

  4. Write SQL to list Top 10 Salesman in the Year 2018 based on the sales

  5. Write SQL to list Top 10 Customers in the Year 2018 based on the sales

Refer to the following Table for Questions 6-7

CREATE TABLE TEST_MSR_SOURCE (
rpt_grp_cd varchar(60) ,
lctn_typ_cd varchar(10) ,
clctn_prd_txt varchar(8) ,
msr_cd varchar(20),
clcltn_date varchar(10),
grp_rate_nmrtr varchar(3),
grp_rate_dnmntr varchar(5) ,
file_name varchar(50),
creat_ts varchar(50),
creat_user_id varchar(30),
submsn_cmplt_cd varchar(1))

CREATE TABLE TEST_MSR_TARGET (
TEST_MSR_TARGET_ID int4 NOT NULL
rpt_grp_cd varchar(60),
lctn_typ_cd varchar(10),
clctn_prd_txt varchar(8),
msr_cd varchar(20),
clcltn_date date,
grp_rate_nmrtr int4,
grp_rate_dnmntr numeric(5),
file_name varchar(50),
finl_sw varchar(1),
creat_ts timestamp NOT NULL,
creat_user_id varchar(30) NOT NULL,
submsn_cmplt_cd varchar(1))

  1. Import .csv file into TEST_MSR_SOURCE using Python Script

  2. Write a Python script that takes all data from TEST_MSR_SOURCE and inserts the data into TEST_MSR_TARGET
    a. Database type = Redshift
    b. Number of rows = 10
    c. Sequential key used for TEST_MSR_TARGET_ID
    d. Data transformations from varchar to (date, int, numeric, timestamp)

  3. Would your script change if the number of rows = 1,000,000? Why or why not

Comments (3)