![]() Sqlite> INSERT INTO inventory(StockNumber,Descrip,OnHandQuan,PackQty,PackCost)VALUES (23155,'Shovel Pointed Long Handle',1500,1,9.82) Sqlite> INSERT INTO inventory(StockNumber,Descrip,OnHandQuan,PackQty,PackCost)VALUES (51013,'D Dry Cells 8 Pack',19,12,90.20) Sqlite> INSERT INTO inventory(StockNumber,Descrip,OnHandQuan,PackQty,PackCost)VALUES (43512,'10W-30 Motor Oil, Quart',36,12,18.20) Sqlite> INSERT INTO inventory(StockNumber,Descrip,OnHandQuan,PackQty,PackCost)VALUES (51004,'AA Dry Cells 8 Pack',5,12,16.80) Sqlite> INSERT INTO inventory(StockNumber,Descrip,OnHandQuan,PackQty,PackCost)VALUES (51002,'AA Dry Cells 4 Pack',173,12,9.00) INSERT INTO table_name( fieldname_1, fieldname_2, fieldname_3)VALUES (' value a',' value b', 0.000) Note that string values are surrounded by single quotes, numeric values are not. SQLite data page (Will open in a new window). Now we fill our currently empty table with the following insert statements containing our data, which can be found on the See the section at the end of the document Putting Data into the Table ![]() That being said, it is still a good idea to do so if you wish to make your database portable to another database management system such as MYSQL or ORACLE, now or sometime in the future. ![]() There is technically no requirement to declare data types when creating a table in SQLite with the possible exception of creating an INTEGER PRIMARY KEY field. Sqlite> CREATE TABLE inventory(StockNumber INTEGER PRIMARY KEY,Descrip VARCHAR(50),OnHandQuan INTEGER,PackQty INTEGER,PackCost FLOAT) Let us say you create the following table to track your inventory and costs for your supplies and equipment where each field name is followed by a data type. If no path is specified then the database file will be placed in the folder in which the program "sqlite3.exe" resides.Ĭ:\Databases\sqlite>sqlite3 C:\Databases\inventoryctrl.dbĬ:\DOCUME~1\COLINR~1\LOCALS~1\Temp\etilqs_i12OPG64gGySrwGXĬREATE TABLE table_name( fieldname_1 data_type, fieldname_2 data_type, fieldname_3 data_type) "cd C:\Databases\sqlite\ ".Īt the command line enter "sqlite3 path and database name " If the database file does not currently exist then it will be created. Here is one example, although the path shown in red text will likely be different on your computer. Using the change directory command (cd), navigate to the folder where the sqlite program is located. Open a command prompt window by either going through the Start menu and selecting the command prompt listing which can usually be found in the accessories menu, or enter "cmd.exe" in the run dialog box of the Start menu. More information on the available dot commands can be found in the SQLite notes section. ![]() For example ".tables" is equivalent to "show tables" function found in many SQL database management systems. These dot commands duplicate functions found in other databases. They are entered on only one line and do not require a terminating character. SQLite dot commands which are specific to this system, serve several special functions. SQL statements may extend for several lines and must be terminated with a semicolumn before the statement will be evaluated by the database engine. In general SQLite uses standard sql syntax but with limited alter table support. It creates and stores the schema, tables and data for each database as a single file which is parsed when the database is opened. SQLite is a compact relational database management system (rdbms) that requires no installation other than having a single executable file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |