-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d00aea
commit 1a0dbb4
Showing
33 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added
BIN
+1.4 MB
Book/1970 A Relational Model of Data for Large Shared Data Banks-IBM-Codd.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#include <stdio.h> | ||
#include <sqlite3.h> | ||
|
||
static int callback(void* data, int argc, char** argv, char** ColName){ | ||
|
||
for(int i = 0; i<argc; i++){ | ||
printf("%s = %s\n", ColName[i], argv[i]); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
|
||
int main(int argc, char* argv[]) { | ||
sqlite3* db; | ||
int c; | ||
|
||
c = sqlite3_open_v2("Moviesion.db", &db, SQLITE_OPEN_READWRITE, NULL); | ||
|
||
if(c) { | ||
printf("Can't open database! %s\n", sqlite3_errmsg(db)); | ||
return(0); | ||
} else { | ||
printf("Connect to database successfully.\n"); | ||
} | ||
|
||
char* errMsg = 0; | ||
//create SQL statement | ||
char* sql = "CREATE TABLE Movie(" \ | ||
"ID INTEGER PRIMARY KEY NOT NULL," \ | ||
"TITLE VARCHAR(255) NOT NULL);"; | ||
|
||
//execute SQL statement | ||
int r = sqlite3_exec(db, sql, NULL, 0, &errMsg); | ||
|
||
if( r != SQLITE_OK ){ | ||
printf("SQL error: %s\n", errMsg); | ||
sqlite3_free(errMsg); | ||
} | ||
else { | ||
printf("Table created successfully\n"); | ||
} | ||
|
||
sql = "INSERT INTO Movie(Id, Title) VALUES(330, 'Psycho');"; | ||
|
||
//execute SQL statement | ||
r = sqlite3_exec(db, sql, NULL, 0, &errMsg); | ||
|
||
if( r != SQLITE_OK ){ | ||
printf("SQL error: %s\n", errMsg); | ||
sqlite3_free(errMsg); | ||
} | ||
else { | ||
printf("Movie inserted successfully\n"); | ||
} | ||
|
||
sql = "SELECT * from Movie"; | ||
|
||
//execute SQL statement | ||
r = sqlite3_exec(db, sql, callback, 0, &errMsg); | ||
|
||
if( r != SQLITE_OK ){ | ||
printf("SQL error: %s\n", errMsg); | ||
sqlite3_free(errMsg); | ||
} | ||
else { | ||
printf("Movies are retrieved successfully\n"); | ||
} | ||
|
||
sqlite3_close(db); | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2 MB
Lectures/Lec03_The_Birds_EERD/Slides/Lec03A_The_Birds_More_Entity_Sets.pdf
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+99.6 KB
...Don't_Be_Squared_Relational_I/Recordings/Lec04A_Don't_Be_Squared_Relational.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+766 KB
Lectures/Lec04_Don't_Be_Squared_Relational_I/Slides/Lec04A_Don't_Be_Squared_Relational.pdf
Binary file not shown.
Binary file added
BIN
+414 KB
Lectures/Lec04_Don't_Be_Squared_Relational_I/Slides/Lec04B_Don't_Be_Squared_Relational.pdf
Binary file not shown.
Binary file added
BIN
+1.07 MB
Lectures/Lec06_Don't_Be_Squared_Relational_II/Slides/Lec06B_Don_t_Be_Squared_Relational.pdf
Binary file not shown.
Binary file added
BIN
+2.02 MB
Lectures/Lec07_Workshop_Algebra/Slides/Lec07A_ER2Relational_Workshop.pdf
Binary file not shown.
Binary file added
BIN
+854 KB
Lectures/Lec07_Workshop_Algebra/Slides/Lec07B_Bend_The_Spoon_RelationalAlgebra.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.54 MB
Lectures/Lec11_Subquery_Layered_Index/Slides/Lec11A_Subquery_Layered_Architecture.pdf
Binary file not shown.
Binary file added
BIN
+44.1 KB
...es/Lec11_Subquery_Layered_Index/Slides/Lec11B_Layered_Architecture_Indexing.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.2 MB
Lectures/Lec11_Subquery_Layered_Index/Slides/Lec11B_Layered_Architecture_Indexing.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.