Database Problems
If you indicate on your résumé that you have some database experience or the job you apply for involves working with databases, interviewers will probably ask you database questions to determine the depth of your knowledge.
Simple SQL
Olympics(
city CHAR(16),
year INTEGER(4)
);
This is an extremely easy problem that an interviewer might use to determine whether you have ever used SQL before or whether you were padding your résumé when you mentioned it. If you know SQL, you’re all set. It’s a straightforward SQL INSERT statement; no tricks. If you don’t know SQL, you’re in trouble. The correct answer is
INSERT INTO Olympics VALUES( 'Montreal', 1976 );
Company and Employee Database
Company (
companyName CHAR(30),
id INTEGER(4) PRIMARY KEY
);
EmployeesHired (
id INTEGER(4),
numHired INTEGER(4),
fiscalQuarter INTEGER(4),
FOREIGN KEY (id) REFERENCES Company
);
companyName | id |
Hillary Plumbing | 6 |
John Lawn Company | 9 |
Dave Cookie Company | 19 |
Jane Electricity | 3 |
id | numHired | fiscalQuarter |
3 | 3 | 2 |
3 | 2 | 4 |
19 | 4 | 1 |
6 | 2 | 1 |
Get Programming Interviews Exposed: Secrets to Landing Your Next Job, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.