In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "what are the basic syntax of Sqlite database". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what are the basic syntax of Sqlite database"?
I. installation
Since we want to learn Sqlite, let's install them first. as we said earlier, it doesn't take much process to install them, that is, no installation, download address:
Https://u062.com/dir/7715018-39794633-fbf2ca
After downloading, we can directly add the application of Sqlite to the environment variable and use it as we like. When we open CMD, we can see this word, which indicates that the installation is successful, as shown in the figure:
II. Graphical interface management
Sqlite has been installed, but it always feels awkward when operating at the command prompt. The editor thinks that a graphical interface tool is needed to manipulate Sqlite, so that the data can be displayed more intuitively. Here I recommend SqliteAdmin, the Chinese version of the interface plus a simple interface design, as shown in the figure:
Note that the software does not work properly at this time, because it does not have a dynamic link library that can parse Sqlite statements, so you also need to download a dynamic link library. Here, the editor has prepared the download address. After download, you can directly copy it to the software directory. Download address:
Https://u062.com/file/7715018-452195159 III. Basic grammar
Sqlite doesn't end with ";" like other databases, and it ends with "." At the beginning, the formula is established. Open our SqliteAdmin, and let's start our journey of pretending.
1. Data type
Null null SMALLLINT short integer INTEGER signed integer this is Boolean type 0 (false) and 1 (true) TINYINT long integer REAL floating point TEXT a large number of text strings BLOB binary object NUMERIC uses the values of all five storage classes VARCHAR (n) variable length strings, can only be stored in English Up to 8000 characters CHAR (n) fixed length string DATA year month day TIME time minute second DOUBLE double precision floating point FLOAT single precision floating point TIMESTAMP storage year month hour minute second NCHAR storage Unicode data type fixed length string, can store English Chinese characters Do more than 4000 characters NVARCHAR storage Unicode data type variable length string NTEXT storage Unicode data type a large number of text strings DATATIME storage date time
In fact, its data types are much more than these, more data types need to be explored, here the editor enumerates just the commonly used data types.
two。 Basic keyword
Knowing the data types, you must also understand the keywords that need to be used when creating a database for operation, so as to improve the efficiency of development.
Between AND and BETWEEN minimum and maximum values EXISTS determines whether there is IN to determine whether a value belongs to another value NOT IN determines whether a value does not belong to another value LIKE uses wildcards to compare values with another value case-insensitive% (for zero, one or more) GLOB uses wildcards to compare values with similar values And case-sensitive * (for zero or more)? (represents one) LIMIT limits the number of values that meet the criteria ORDER BY sort ASC (ascending order) | DESC (descending order) GROUP BY data aggregation HAVING filtering packets. Be sure to use GROUP BY DISTINCT to eliminate all duplicate records NOT before use. Often use OR or IS NULL together with in to determine whether it is equal to a null value. The type operator IS is equivalent to'='IS NOT to determine whether it is not equal to'! = "UNIQUE does not repeat UNION eliminates all duplicate rows UNIONALL does not eliminate duplicate rows WHERE is used to satisfy a condition when SELECT selects FROM from INSERT INTO insertion table data PRIMARY Key main column DEFAULT default CHECK check
3. Database related operations
1)。 Create a database file
First, we want to create a database file that ends with ".db", as follows:
We can also create a database at the command prompt, as follows:
This creates a "test" database file, and after we create it, we enter the "test" database, and then we can do other operations.
2)。 View the database
.database. Both are fine.
3)。 Exit the database
.quit
4)。 Export database
Sqlite3 test.db .dump > test.sql
5)。 Create an additional database
ATTACH DATABASE 'test1.db' as' test1'; ATTACH DATABASE 'test2.db' as' test2'
The above operation is to store all the database data in the database file "test.db", but this is not recommended in the actual development, it is recommended to do a few more databases, or embed the database into other databases.
6)。 Show additional databases
.database. Both are fine.
7)。 Detach database
DETACH DATABASE 'test1'
At this point, I believe you have a deeper understanding of "what is the basic syntax of Sqlite database?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.