sqlite database question
CS 157A Fall 2020 Project 1
Point: 10
Instructions:
1. Due Date: Oct 28, 2020
2. Can be done individually or as Team of at most 4 students
3. Only one student needs to submit the project with the names of team members
4. Project submission includes source code files which was changed to implement the solution to given problem statement and
project report
should explains the process (research, code changes, build process, unit test results)
5. Download source code from SQLite website (https://www.sqlite.org/src/doc/trunk/README.md)
6. Read custom build steps from SQLite website
Problem Statement:
Problem 1:
First take a look at the following SQLITE3 shell – SQL commands and responses:
sqlite> create table cs157a(sjsu_id int, name varchar(5));
sqlite> insert into cs157a values(1050,’Mary’);
sqlite> insert into cs157a values(1001,’Alice’);
sqlite> insert into cs157a values(1200,’Trudy’);
sqlite> insert into cs157a values(1001,’John’);
sqlite> insert into cs157a values(2050,’Judy’, ‘A+’);
Error: table cs157a has 2 columns but 3 values were supplied
We created a new table (cs157a) with 2 columns, then we tried to insert a new tuple into this table but only 3 values were specified instead of 2 values. This led to the error “Error: table cs157a has 2 columns but 3 values were supplied”. It will be helpful, if this error message can provide more information e.g. schema of the table.
So, in this project you have to make the change to SQLite source code so that the response to such user error looks like:
sqlite> insert into cs157a values(2050,’Judy’,’A+’);
Metadata help: cs157a{sjsu_id,name}
Error: table cs157a has 2 columns but 3 values were supplied
Problem 2:
ORDER BY sorts the output rows in
ascending
order (by default). In this project, you have to change the default behavior to descending order.
Example:
sqlite> select * from cs157a order by sjsu_id;
sjsu_id name
———- ———-
1200 Trudy
1050 Mary
1001 Alice
1001 John
Take a look at the output table, all rows are in descending order of sjsu_id column values but SQL query did not specify order by sjsu_id desc.
C language skills:
1. Printf
2. STRUCT
3. Array
4. Pointers
5. define
6. for loop to traverse array of STRUCT