SQL Interview Questions
- 0of 0 votes
AnswersPlease provide Oracle SQL and PLSQL questions
- subhasinibhosal1004 July 17, 2015 in India| Report Duplicate | Flag | PURGE
Wipro Technologies Software Developer SQL - 1of 3 votes
AnswersRound 4
- sonesh July 12, 2015 in United States
Question 4 : You are given following input
Input{userId, LoginTime}
You have ping output in following way
Output(UserId, LoginTime, SessionId).
Note that the session Id is an integer, and when a user login after 30 minutes of its previous login, you will give him/her next sessonid.
new user, will always get next sessionId.
Example
Input
1 9:00 AM
2 9:10 AM
1 9:25 AM
30 12:34PM
23 3:09 PM
Output
UserId LoginTime SessionId
1 9:00 AM 1
2 9:10 AM 2
1 9:25 AM 1
30 12:34PM 3
23 3:09 PM 4
You have to do it in either SQL/Scope. You also have to minimise the complexity.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer SQL - -1of 1 vote
AnswersRound 2
- sonesh July 12, 2015 in United States
Question 3 : You are given following set of tables
Object{obj_id, obj_name,....<Other object related details>}
Attribute{att_id, att_name,....<Other attribute related details>}
ObjectAttributeMapping{objAtt_id, obj_id, att_id, att_value}
You have to provide the output in following format
Output table with column name {obj_id, obj_name, att_name1, att_name2, att_name3,...}
each object should only be represented in one row, and att_name1 column will have att_id1 values, from ObjectAttributeMapping table, similarly att_name2 column will have value of att_id2 from ObjectAttributeMapping etc...
Note that you have to do this in either SQL/Scope.
Example
Object
obj_id obj_name
1 cube
2 square
3 matrix
Attribute
Att_id Att_name
1 color
2 height
3 length
4 width
ObjectAttributeMapping
objAtt_id obj_id att_id att_value
1 1 1 'red'
2 1 2 10
3 1 3 12
4 1 4 5
5 2 1 'green'
6 2 2 6
7 3 3 5
8 3 4 9
Output should be
obj_id obj_name color height length width
1 cube 'red' 10 12 5
2 square 'green' 6 null null
3 matrix null null 5 9| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer SQL - -1of 1 vote
AnswersRound 2
- sonesh July 12, 2015 in United States
Question 2 : You are given following two tables,
Customer{cust_id, cust_name, ...<Other customer related details>}
Order{order_id, order_name, cust_id, ...<Other order related details>}
You have to provide the output in following format.
cust_id, cust_name, [Total amount of orders]
Please note that you have to do this in SQL/Scope, and print only those customer who have at least one order.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer SQL - 0of 0 votes
AnswersIf given a binary file, with data like lat, long, weather, temp in key:value. It's a structured data how would u ingest it. what are the steps that are being taken before Hive process starts.
- Tom Walker June 07, 2015 in United States
- serde (serializartion deserialization). parque etc.| Report Duplicate | Flag | PURGE
Amazon Software Developer Algorithm Data Mining Data Structures Database Distributed Computing Java SQL - 1of 1 vote
AnswersWrite sql to get occurence of characters in given column
- Tom Walker June 07, 2015 in United States
Remove duplicate rows from sql table leaving one unique row.| Report Duplicate | Flag | PURGE
Amazon Software Developer SQL System Design - 1of 1 vote
AnswersHow would you increase efficiency of a hive query?
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Data Mining Data Structures Database Debugging SQL - 0of 0 votes
AnswerWhat is input split in hadoop.
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Data Mining Data Structures Database Java SQL - 0of 0 votes
AnswersHow Solr/Lucene or Elasticsearch work? For what purpose are they used?
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Developer Data Mining Data Structures Database Large Scale Computing SQL - 0of 0 votes
AnswersWhat are different phases of Map reduce operation - I think they were looking for split, combiners, partitioners, sorting phases of whole map reduce stage.
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Developer Data Mining Data Structures Database Distributed Computing Java Large Scale Computing SQL - 0of 0 votes
Answersfind the max length of name(1stName+2ndName+MiddleName) table value.
- poojaarora014 February 22, 2015 in India| Report Duplicate | Flag | PURGE
Deshaw Inc SDET SQL - 0of 0 votes
AnswersSuppose that Amazon web site has two data tables: One is the customer table. The other is the order table. How do you find the customers who never order anything?
- joeyk December 06, 2014 in United States for Supply Chain| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer / Developer SQL - 0of 0 votes
Answers1. If we have 2 column in table, user id and date which user has logged in. How can we find the user id who has logged in most. means max number of time.
- newbee September 03, 2014 in United States| Report Duplicate | Flag | PURGE
Software Engineer / Developer SQL - 0of 0 votes
AnswersWrite a query which return 5 persons who had spent most from a table and table contains customer id, product id and expenses. Customer id can be duplicate.
- newbee August 30, 2014 in United States| Report Duplicate | Flag | PURGE
Apple Software Engineer / Developer SQL - 0of 0 votes
AnswersTable 1; transaction_id, price
- Buzzle August 26, 2014 in United States
Table 2: transaction_id, zipcode
Query to find the avg price per zipcode
Query to show zipcodes that have an avg price more than $5.| Report Duplicate | Flag | PURGE
Ebay Analyst SQL - 0of 0 votes
AnswersWhat is difference between Having and where clause?
- Buzzle August 26, 2014 in United States| Report Duplicate | Flag | PURGE
Ebay Analyst SQL - 0of 0 votes
AnswersTo schedule a job which will run in weekdays between 3pm to 5pm , in a interval of 15min.
- sunpratikkumar2 August 18, 2014 in India
(its for oracle 10g so it doesn't support schedular
** without using repeat_interval.)| Report Duplicate | Flag | PURGE
omega Applications Developer SQL - 0of 2 votes
AnswersDesign a system like friend's functionality in facebook. should have all features of facebook's friends functionality. like for each person , he can have any number of friends , he will get suggestions for new firends , showing common friends if we visits any other profile . algo should be scalable , robust .
- gopi.komanduri August 02, 2014 in United States| Report Duplicate | Flag | PURGE
Computer Scientist Algorithm Android Application / UI Design Arrays Bit Manipulation C# C++ Cache Coding Computer Architecture & Low Level Data Mining Data Structures Database Distributed Computing Dynamic Programming Hash Table Java Large Scale Computing Linked Lists Math & Computation Object Oriented Design Problem Solving Sorting SQL Stacks System Design Trees and Graphs XML - 2of 4 votes
AnswersHaving a table Genre with two colums (Id, Genre) make an SQL Query that finds the Ids with the genre Action and Comedy. (those will have multiple lines for each Id)
Answer:
- mikeldi10 June 19, 2014 in UK for Amazon Instant Videoselect g.id from (select id from genre where genre = 'Action') x, genre as g where g.id = x.id and genre = 'Commedy'
| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer SQL - 0of 0 votes
AnswersWhat is composite key? How it differs from candidate key?
- kaustubh deshmukh June 19, 2014 in India| Report Duplicate | Flag | PURGE
TATA Consultancy Services Dev Lead Dev Lead SQL - 0of 0 votes
Answerswe have 2 tables A & B. write a query to get just the non matching data from B table using joins
- shubhi June 08, 2014 in India| Report Duplicate | Flag | PURGE
Quality Assurance Engineer SQL - -2of 2 votes
AnswersTable 1: Parents -> (int id, int age)
- pennepalli May 30, 2014 in United States
Table 2: Children -> (int id, int age, int parent_id)
Get the parent id, his/her oldest and youngest children ids.| Report Duplicate | Flag | PURGE
Google Developer Program Engineer SQL - -1of 3 votes
AnswersTable 1: Parents -> (int id, int age, int Child_id)
- pennepalli May 30, 2014 in United States
Table 2: Children -> (int id, int age, int parent_id)
Get the parent id, his/her oldest and youngest children ids.| Report Duplicate | Flag | PURGE
Google Developer Program Engineer SQL - 0of 0 votes
AnswersGiven a table of the form:
- 14mit1010 May 11, 2014 in United States
1 A,B,C,A,B
2 A,B,A,A,A
3 C,D,C
Give the number of duplicate characters, eg: for 1 there are 2 A's and 2 B's, so the result is 2
For 2 A is repeated 4 times so the result is 3
For 3, C is repeated twice so the result is 1
My suggestion was to use a CLRSQL function to calculate it| Report Duplicate | Flag | PURGE
Microsoft SDE1 SQL - 0of 0 votes
AnswersGiven two tables
- hulk April 29, 2014 in India
1. Candidate having: Id , Name
2. Vote: Id, CandidateId
Give query to give the name of the winning candidate| Report Duplicate | Flag | PURGE
Infibeam SDE-2 SQL - 0of 0 votes
AnswerFurther on, the design tables and more SQL queries given some business requirements. And how would I do the same using MapReduce.
- unreal March 28, 2014 in United States| Report Duplicate | Flag | PURGE
FactSet Research Systems, Inc Software Engineer / Developer SQL - 0of 0 votes
AnswersThe question was I have a table containing millions of records and I have to calculate sum, avg, mean, median and SD without using inbuilt methods of SQL ( I can use count though).
- unreal March 28, 2014 in United States
And that has to done by writing only SQL queries.`| Report Duplicate | Flag | PURGE
FactSet Research Systems, Inc Software Engineer / Developer SQL - -1of 1 vote
Answerstypes of index, diff between table and view
- arun.md12 March 04, 2014 in India
stored procedures, slow performance query tuning| Report Duplicate | Flag | PURGE
Morgan Stanley Software Engineer / Developer SQL