← 返回 openai 的题目列表Design a simple database class with insert and query methods
类型:online_judge
Design a simple database class with insert and query methods. Your task is to implement the insert and query functions. The query function should mimic SQL syntax to support queries like:
select name from table;
select name, birthday from table;
Provide some test cases to ensure the code can compile and run correctly, and that the code is clean and understandable.
Follow-up question: Add the functionality to include a where clause in the query function, supporting queries like:
select name, birthday from table where birthday > '1900-01-01';
Provide test cases and ensure the code compiles and runs correctly.
Example
Input
insert({'name': 'Alice', 'birthday': '1995-07-13'})
query('select name from table')