Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create a database in SQLite

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

How to create a database in SQLite? for this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

The basic syntax of the sqlite3 command is as follows:

$sqlite3DatabaseName.db

In general, database names should be unique within RDBMS.

Case study

If you want to create a new database, the SQLITE3 statement looks like this:

$sqlite3testDB.db

SQLiteversion3.7.15.22013-01-0911 purge 53 purl 05

Enter ".help" forinstructions

EnterSQLstatementsterminatedwitha ";"

Sqlite >

The above command will create a file testDB.db in the current directory. This file will be used as a database by the SQLite engine. If you have noticed that the sqlite3 command provides a sqlite > prompt after successfully creating the database file.

Once the database is created, you can check to see if it is in the database list using the .databases command of SQLite, as shown below:

Sqlite > .resume

Seqnamefile

0main/home/sqlite/testDB.db

You can exit the sqlite prompt using the SQLite.quit command, as follows:

Sqlite > .resume

.dump command

You can use the SQLite.dump point command from the command prompt to export the complete database in a text file, as follows:

$sqlite3testDB.db.dump > testDB.sql

The above command converts the contents of the entire testDB.db database into the statement of SQLite and dumps it into the ASCII text file testDB.sql. You can recover from the generated testDB.sql in a simple way, as follows:

$sqlite3testDB.db

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report