Common Tasks in SQLite Manager
Create a New Database
To create a new database file, go to the Database drop down menu and
select "Create Database".
A dialog box will pop up, enter the database name. A suffix will be appended to that name. The default file extension is ".sqlite " however you can specify that a different suffix be applied to new SQLite databases by going to the "Tools" drop down menu and selecting "Options". This will bring up the "SQLite Manager Options" dialog box. Select the "Main" tab and enter the new extension where it says "Default file extension of SQLite files"
Open an Existing DatabaseTo open an existing SQLite database file, go to the Database drop down menu in the Menu bar and select "Connect Database".
The Select SQLite Database dialog box will pop up allowing you the browse for the file.
You also bring up this dialog box with the letter key combinations of Alt + D and then Ctrl + O.
Create A Table
- From the “View” drop down Menu at the top of the screen, select “Create Table” to open the Create Table dialog box.
- Enter tablename, column names and data types for columns.
I would recommend against using the INTEGER (strict), TEXT(strict) or REAL(strict) data types for most applications.
- Check any column(s) which is part of the table's PRIMARY KEY. It is possible to add a Primary and or Foreign Key later using the Structure tab to edit the datatype associated with one of the columns in a table.
- Click the OK button in the Create Table dialog box.
Add a new record to a table
- Select the table from the Database Objects Panel.
- Go the the Browse & Search tab.
- Click on the Add New Record button or press the Alt + A key combination to bring up the data entry form for the table.
- Fill in the form, tab down to the OK button and press enter.
Edit records within a table
Double click on the record to edit to bring up the Edit Record dialog box.
Edit the record and confirm by clicking the OK button in the dialog box.
Note: Editing multiple records at the same time will require that a SQL UPDATE statement be entered into the Execute SQL tab.
- Select the table from the Database Objects Panel.
- From the Browse & Search tab, highlight the record(s) to be deleted.
- Right click for the context menu and select delete or click on the Delete button at the top of the tab.
Task : Make a Copy of a table within a SQLite Database
- In the Database Object Panel, click on the name of the table to be copied to highlight it
- Right mouse click to bring up the table menu or click on the Table drop down menu on the menu bar. Select the "Copy Table" option.
- A dialog box will open, enter the new table name.
- By default rows stored in the old table will be copied along with the structure to the new table. Use the check box in the dialog if you only want to copy the structure.
Task : Copy a table from one SQLite Database into another
- Open one of the databases then select Attach Database from the Database menu.
- Use the dialog box to browse for the second database and enter an alias for it.
- Using the drop down box at the top of the navigation pane select the database where the table to be copied is located.
- Highlight that table and select the "Copy Table" option from the Table Menu.
- A dialog box will open, select the database that the table is to be copied to.
- Enter the new table name. Use the check box in the dialog if you only want to copy the table structure. Click OK.
Drop or Delete A Table
- Highlight the table name to delete in the left hand menu.
- Go to the table drop down menu, select the “Drop Table” option.
- A dialog box will pop up asking you to confirm the action.
Save the Results of a Select Query
You can save the results of a query by Copying rows from Query Result and pasting them into a spreadsheet program such as Excel or Gnumeric.
- Highlight the records that you want to copy.
- Right click your mouse to bring up the context menu.
- Select Copy Rows as CSV (MS Excel Compatible).
- Paste the records into the spreadsheet as Text
To include column names in the file, run a CREATE TABLE AS SELECT statement to generate a Table within the database and then export the table as a CSV file which can be opened by most Spreadsheet Programs.
Queries can also be retained within the Execute SQL tab of SQLite Manager by going to the Tools menu in the Menu bar and checking the Use Table for Extension Data item . After that it will only be necessary to click on the little diskette icon in the Execute SQL tab which will prompt you to enter a query name.
A view is a saved SELECT query that is read only. Each time the VIEW is opened the query is run.
Task : Create a View
- Test the select statement that you wish to use in the Execute SQL tab to verify that the query will produce the results that you want.
- Copy the SELECT statement by highlighting it and pressing ctrl C or right click your mouse to get the copy/paste menu.
- From the “View” drop down Menu at the top of the screen, select “Create View” to open the Create View dialog box.
- Paste the sql query in the “Select statement” text area, enter a view name and click the OK button in the dialog box.
- Select the view from the left menu and copy the original specification from the “Structure” tab.
- Paste the specification into "Enter SQL" text box of the Execute SQL tab.
- Remove "CREATE VIEW 'view_name' AS" leaving only the sql query.
- Edit and test the sql query until the desired results are obtained.
- Copy the sql query into the clipboard by highlighting it and pressing ctrl C or right click your mouse to get the copy/paste menu.
- From the structure tab, click on the modify button for the VIEW to be changes. You should be the Modify View dialog box pop up.
- Paste the sql query in the “Select statement” text area of the dialog box click the Ok button.
SQLite Manager Menu Bar Drop Down Listings
|New Database||Create Table||Create Index||Create View||Create Trigger||Options||Report A Problem|
|New In-Memory Database||Drop Table||Drop Index||Drop View||Drop Trigger||Shared Pager Cache||Frequently Asked Questions|
|Connect Database||Empty Table||Reindex Index||Rename View||Rename Trigger||Use Table for Extension Data||SQLite Homepage|
|Close Database||Rename Table||Modify View||Open On-Connect SQL Tab||SQLite Syntax Help|
|Recently Used||Modify Table||Export View||Extension Homepage|
|Attach Database||Copy Table||About SQLite Manager|
|Detach Database||Export Table|
|Copy Database||Reindex Table|
|Export All Tables|
|Export Database Structure|
Colin Riley --Updated January 2011--