holdnet
BAN USER- 1of 1 vote
AnswersWrite a sql parser to properly parse queries for a particular table. The input will consist of several lines: the first line is of two values, N and M, separated by a comma. The next line has the names of the columns of the table. The next N lines will contain N rows of the table (each column delimited by a comma). After that, the next M lines will contain where clause of sql query which you are supposed to execute and return their output (one in each line).
- holdnet in India
Table input will be in the following format:
“ID”,”Name”,”Date” 1,”Narendra Moody”,”2014-10-23 12:21″ . . . 100,”Rahul Pandey”,”2013-11-02 13:01″
Query input will be given in following format: ID > 99 and Name = “Rahul Pandely”
You are supposed to evaluate query and print the number of rows that come under the criteria. For example solution for above query will be 1.
Sample Input (Plaintext Link)
6, 1
“ID”,”Name”,”Date”,”Score”
1,”Aditya Moody”,”2014-10-23 11:55″,20
2,”Utsav Moody”,”2014-10-24 15:18″,21
3,”Jon Doe”,”2014-10-23 02:51″,62
4,”Foo Bar”,”2014-10-23 12:00″,98
5,”Rahul Moody”,”2014-10-23 12:31″,61
6,”Umang JarJar”,”2014-10-23 11:21″,33
Date > “2014-10-23 12:00″
Sample Output (Plaintext Link)
2| Report Duplicate | Flag | PURGE
Intern parsing - 0of 0 votes
AnswersWrite a sql parser to properly parse queries for a particular table. The input will consist of several lines: the first line is of two values, N and M, separated by a comma. The next line has the names of the columns of the table. The next N lines will contain N rows of the table (each column delimited by a comma). After that, the next M lines will contain where clause of sql query which you are supposed to execute and return their output (one in each line).
- holdnet
Table input will be in the following format:
“ID”,”Name”,”Date” 1,”Narendra Moody”,”2014-10-23 12:21″ . . . 100,”Rahul Pandey”,”2013-11-02 13:01″
Query input will be given in following format: ID > 99 and Name = “Rahul Pandely”
You are supposed to evaluate query and print the number of rows that come under the criteria. For example solution for above query will be 1.
Sample Input (Plaintext Link)
6, 1
“ID”,”Name”,”Date”,”Score”
1,”Aditya Moody”,”2014-10-23 11:55″,20
2,”Utsav Moody”,”2014-10-24 15:18″,21
3,”Jon Doe”,”2014-10-23 02:51″,62
4,”Foo Bar”,”2014-10-23 12:00″,98
5,”Rahul Moody”,”2014-10-23 12:31″,61
6,”Umang JarJar”,”2014-10-23 11:21″,33
Date > “2014-10-23 12:00″
Sample Output (Plaintext Link)
2| Report Duplicate | Flag | PURGE
I think that your solution is correct. I had a similar solution in mind, you just confirmed it validness. Thanks.
- holdnet January 04, 2016