2022暑期实习-特斯拉-笔试

公司:特斯拉

岗位:IT应用支持工程师实习生

笔试平台:Codility

考试时长:130分钟

考试题型:两道SQL,一道Python

Task1

You are given two tables, department and employee, with the following structure:

create table department (
 	dept_id integer not null,
 	dept_name varchar(30) not null,
	dept_location varchar(30) not null,
	unique(dept_id)
);

create table enployee (
	emp_id integer not null,
	emp_name varchar(50) not null,
	dept_id integer not null,
	salary integer not null,
	unique(emp_id)
);

Each record in the table department represents a department which might hire some employees. Each record in the table employee represents an employee who works for one of the departments from the table department. The salary of each employee is known. (However, the locations of the departments are not relevant here.)

Write an SQL query that returns a table comprising all the departments (dept_id) in the table department that hire at least one employee, the number of people they employ and the sum of salaries in each department. The table should be ordered by dept_id (in increasing order).

Task2

Codility is a company that creates programming tasks which are solved by candidates. After submitting their solution to a task, each candidate receives a report containing the number of points their solution scored, which is an integer between 0 and 100.

You are given two tables, tasks and reports, with the following structure:

0create table tasks (
	id integer not null,
	name varchar(40) not null,
	unique(id)
);

create table reports(
	id integer not null,
	task_id integer not null,
	candidate varchar(40) not null,
	score integer not null,
	unique(id)
);

Your task is to write an SQL query which assigns a difficulty rating to depends on the average score of all candidates' solutions submitted each task . The difficulty of the task depends on the average sc

剩余60%内容,订阅专栏后可继续查看/也可单篇购买

一个普通数据人的成长之路 文章被收录于专栏

记录实习和校招的笔试面试(标题年份表示笔试或面试的年份)和个人成长,牛友们的点赞、评论、收藏就是更新的动力和支持~

全部评论

相关推荐

评论
2
14
分享

创作者周榜

更多
牛客网
牛客企业服务