SQLite 3超越基础

In the introductory post to SQLite 3, we covered some basic commands, database and table creation, and more. In this one, we’ll go into more depth – exploring both familiar features from other databases and features that make SQLite stand out.

SQLite 3介绍性文章中 ,我们介绍了一些基本命令,数据库和表的创建等。 在这一篇文章中,我们将进行更深入的研究-探索其他数据库中熟悉的功能以及使SQLite脱颖而出的功能。

alt

It is assumed you went through the introductory post before continuing with this one, or that you are comfortable with the basics of SQLite 3.

假定您在继续此文章之前先阅读了介绍性文章,或者您熟悉SQLite 3的基础知识。

选择查询 (SELECT Query)

SELECT is a standard SQL command and belongs in the Data Query Language (or DQL). It lets you perform queries on a database and fetch required records. The results can be further filtered using various clauses provided by SQLite.

SELECT是标准SQL命令,属于数据查询语言(或DQL)。 它使您可以对数据库执行查询并获取所需的记录。 可以使用SQLite提供的各种子句进一步过滤结果。

Open up the terminal and type: sqlite3 Library.db

打开终端并输入: sqlite3 Library.db

This would create a database named Library.db in the current directory. Now, let us create a table that stores information about library users. A library user must have a name, an ID provided by the library which is unique, a user’s age and their date of joining. The following SQL query will create this table:

这将在当前目录中创建一个名为Library.db的数据库。 现在,让我们创建一个表,该表存储有关库用户的信息。 库用户必须具有名称,库提供的ID(唯一),用户的年龄及其加入日期。 以下SQL查询将创建此表:

CREATE TABLE Users ( 
  SerialNo INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  Name TEXT NOT NULL,
  Id TEXT NOT NULL UNIQUE,
  Age INTEGER NOT NULL,
  DOJ TEXT NOT NULL );

SerialNo is the Primary Key.

SerialNo是主键。

Remember: There can be any number of UNIQUE columns in a table but there must only be one PRIMARY KEY.

请记住:一个表中可以有任意数量的UNIQUE列,但只能有一个PRIMARY KEY

Insert a record into the table using the following query:

使用以下查询将记录插入表中:

INSERT INTO Users ( Name, Id, Age, DOJ)
VALUES ( 'Shivam', 'U123', 19, '2015-01-31' );

Note: SQLite does not have a different datatype just for dates. To store Dates in SQLite you must enter them in YYYY-MM-DD format or they will be treated as strings.

注意: SQLite没有仅用于日期的其他数据类型。 要将日期存储在SQLite中,您必须以YYYY-MM-DD格式输入日期,否则它们将被视为字符串。

You can insert more records using the above command, but it would be tedious for a large set of data. We will use the .read meta-command. It executes SQL queries from the specified file. Save the following to a file called newusers.sql:

您可以使用上述命令插入更多记录,但是这对于大量数据而言将是乏味的。 我们将使用.read元命令。 它从指定的文件执行SQL查询。 将以下内容保存到名为newusers.sql的文件中:

BEGIN TRANSACTION;

CREATE TABLE NewUsers (
    SerialNo INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    Name TEXT NOT NULL,
    Id TEXT NOT NULL UNIQUE,
    Age INTEGER NOT NULL,
    DOJ TEXT NOT NULL );

INSERT INTO NewUsers VALUES (1,  'Abraham',     'U123', 19, '2015-02-28');
INSERT INTO NewUsers VALUES (2,  'Michael',     'U124', 23, '2014-12-14');
INSERT INTO NewUsers VALUES (3,  'Steve',       'U125', 35, '2012-11-20');
INSERT INTO NewUsers VALUES (4,  'Ben',         'U126', 15, '2013-05-12');
INSERT INTO NewUsers VALUES (5,  'Alice',       'U127', 17, '2013-03-01');
INSERT INTO NewUsers VALUES (6,  'Christopher', 'U128', 19, '2014-05-03');
INSERT INTO NewUsers VALUES (7,  'Elena',       'U129', 27, '2011-07-14');
INSERT INTO NewUsers VALUES (8,  'Daniel',      'U130', 43, '2010-08-14');
INSERT INTO NewUsers VALUES (9,  'Candice',     'U131', 18, '2014-02-05');
INSERT INTO NewUsers VALUES (10, 'Billy',       'U132', 20, '2015-01-24');
INSERT INTO NewUsers VALUES (11, 'Michael',     'U133', 19, '2013-02-12');
INSERT INTO NewUsers VALUES (12, 'Alice',       'U134', 25, '2010-07-14');
INSERT INTO NewUsers VALUES (13, 'Richard',     'U135', 40, '2011-12-14');
INSERT INTO NewUsers VALUES (14, 'Lester',      'U136', 18, '2014-09-05');
INSERT INTO NewUsers VALUES (15, 'Malvo',       'U137', 21, '2015-01-04');
INSERT INTO NewUsers VALUES (16, 'Alice',       'U138', 19, '2013-02-02');
INSERT INTO NewUsers VALUES (17, 'Drako',       'U139', 24, '2010-12-02');

COMMIT;

and read it from the sqlite command line using:

并从sqlite命令行使用以下命令读取它:

.read newusers.sql

.read newusers.sql

If everything goes well, you will have a NewUsers table with new records. Use the SELECT query to display them.

如果一切顺利,您将拥有一个包含新记录的NewUsers表。 使用SELECT查询显示它们。

SELECT Id, Name, Age, DOJ
FROM NewUsers;

By default, column headers are not displayed and display mode is set to line. Switch on the header display by entering .header ON and change mode style to column using .mode column. Enter the SELECT query again.

默认情况下,不显示列标题,并且显示模式设置为line。 通过输入.header ON标题显示,然后使用.header ON将模式样式更改为.mode column 。 再次输入SELECT查询。

Tip: Use the .show command to display values of various settings. You can also specify the column width manually using the .width1 meta-command.

提示:使用.show命令可显示各种设置的值。 您也可以使用.width 1元命令手动指定列宽。

You can change the number of columns to be displayed and specify another name (alias) for a header. For example:

您可以更改要显示的列数,并为标题指定其他名称(别名)。 例如:

SELECT Id AS 'User ID', Name, DOJ AS 'Date of Joining'
FROM NewUsers;

You can use the .schema command to display all the SQL statements that were used to create the database. You can optionally provide a table name to it, to display the schema of the particular table.

您可以使用.schema命令显示用于创建数据库的所有SQL语句。 您可以选择为其提供表名,以显示特定表的架构。

条款 (WHERE Clause)

The WHERE clause specifies a condition to fetch the results. For instance, to fetch user IDs and names with age 20 or above we can enter the following query.

WHERE子句指定获取结果的条件。 例如,要获取年龄在20岁或以上的用户ID和名称,我们可以输入以下查询。

SELECT Id, Name FROM NewUsers
WHERE Age >= 20;

经营者 (Operators)

SQLite3 provides a number of operators to optimize the WHERE clause. Binary operators in the descending order of their precedence are:

SQLite3提供了许多运算符来优化WHERE子句。 二进制运算符的优先级从高到低依次为:

||
*   /   %
+   -
<<  >>  &   |
<   <=  >   >=
=   ==  !=  <>  IS  IS NOT  IN  LIKE  GLOB  MATCH  REGEXP
AND   
OR

SQLite3 supports four unary prefix operators, - + ~ NOT.

SQLite3支持四个一元前缀运算符- + ~ NOT

Besides these, there are some other operators like BETWEEN and EXISTS.

除了这些,还有其他一些运算符,例如BETWEENEXISTS

之间 (BETWEEN)

Provides a range of values (minimum to maximum) to operate on. For example, to select users that have a date of joining between 12-30-2011 and 12-30-2014 and with age between 17 and 27 we can enter the following query:

提供一系列值(最小值到最大值)进行操作。 例如,要选择加入日期为12-30-2011 12-30-2014月30日至12-30-2014 12月30日且年龄在17至27岁之间的用户,我们可以输入以下查询:

SELECT * FROM NewUsers
WHERE DOJ BETWEEN '2011-12-30' AND '2014-12-30' 
AND Age BETWEEN 17 AND 27;
AND,OR和NOT (AND, OR and NOT)

The AND operator provides an intersection of two conditions, where as the OR operator provides a union of the two conditions. For example, to select users with Age greater than 20 and with SerialNo greater than 5, enter the query:

AND运算符提供两个条件的交集,而OR运算符提供两个条件的并集。 例如,要选择年龄大于20且序列号大于5的用户,请输入查询:

SELECT * FROM NewUsers
WHERE Age > 20 AND SerialNo > 5;

Now, to select users with Age > 20 or users with SerialNo > 5, enter:

现在,要选择年龄> 20的用户或序列号> 5的用户,请输入:

SELECT * FROM NewUsers
WHERE Age > 20 OR SerialNo > 5;

The NOT operator is simply the negation of the corresponding condition. Users that do not have Ages between 20 and 30 can be extracted using:

NOT运算符只是对应条件的否定。 年龄在20到30岁之间的用户可以使用以下方法提取:

SELECT * FROM NewUsers
WHERE Age NOT BETWEEN 20 AND 30;
是和不是 (IS and IS NOT)

IS and IS NOT work same as = (equals to) and != (not equals to) respectively.

ISIS分别= (等于)和!= (不等于)相同。

IN和NOT IN (IN and NOT IN)

The IN operator searches for a value in a list of literals. For example, to search for users with library IDs U124, U127 and U129:

IN运算符在文字列表中搜索值。 例如,要搜索库ID为U124,U127和U129的用户:

SELECT * FROM NewUsers
WHERE Id IN ('U124', 'U127', 'U129');
像和GLOB (LIKE and GLOB)

LIKE does a pattern matching comparison using wildcards % and _. % wildcard matches zero or more characters and _ matches any single character. To select users with names beginning with ‘B’, ending with ‘y’ and the third last character as ‘l’ we may enter:

LIKE使用通配符%_进行模式匹配比较。 %通配符匹配零个或多个字符, _匹配任何单个字符。 要选择名称以“ B”开头,以“ y”结尾,倒数第三个字符为“ l”的用户,我们可以输入:

SELECT * FROM NewUsers
WHERE Name LIKE "B%l_y";

Note: LIKE is case insensitive, so “B%” and “b%” work the same when used with LIKE.

注意: LIKE不区分大小写,因此与LIKE一起使用时,“ B%”和“ b%”的作用相同。

GLOB is similar to LIKE except it is case sensitive and uses Unix File Globbing syntax.

GLOBLIKE相似,但它区分大小写并使用Unix File Globbing语法。

存在 (EXISTS)

The EXISTS operator evaluates either to 0 or to 1. If the query to the right of EXISTS returns no rows then EXISTS returns zero and if the query returns one or more rows then EXISTS returns one.

EXISTS运算符的计算结果为01 。 如果EXISTS右侧的查询不返回任何行,则EXISTS返回零;如果查询返回一或多个行,则EXISTS返回一。

SELECT EXISTS ( SELECT * FROM NewUsers WHERE Age < 10 );

This would return a zero since there are no users with Age less than 10.

由于没有年龄小于10的用户,这将返回零。

|| 操作员 (|| Operator)

|| operator concatenates the specified strings. The below query would give the result: “sitepoint.com”.

|| 运算符连接指定的字符串。 以下查询将给出结果:“ sitepoint.com”。

SELECT 'sitepoint' || '.' || 'com';

按条款订购 (ORDER BY Clause)

As it implies, the ORDER BY clause sorts the records in either ascending or descending order. It operates on a particular column and accepts ASC for ascending order and DESC for descending order.

顾名思义, ORDER BY子句以升序或降序对记录进行排序。 它在特定的列上操作,并接受ASC的升序和DESC的降序。

For instance, to sort all user records in ascending order of Name.

例如,以“名称”的升序对所有用户记录进行排序。

SELECT * FROM NewUsers
ORDER BY Name ASC;

To sort user records in descending order of Age and with Date of Joining after 2013-05-12, you must enter the following query:

要按年龄降序并在2013-05-12之后加入日期对用户记录进行排序,必须输入以下查询:

SELECT * FROM NewUsers
WHERE DOJ > '2013-05-12' ORDER BY Age DESC;

限制条款 (LIMIT Clause)

LIMIT clause limits the number of results of a query to the specified number. It comes with an optional OFFSET flag that declares the number of records to be skipped. For example to select the sixth, seventh and eighth record we need to put a limit of three and an offset of 5.

LIMIT子句将查询的结果数限制为指定的数。 它带有一个可选的OFFSET标志,该标志声明要跳过的记录数。 例如,要选择第六条,第七条和第八条记录,我们需要将限制设置为三,偏移量为5。

SELECT * FROM NewUsers
LIMIT 3 OFFSET 5;

Note: The above query can also be written as: SELECT * FROM NewUsers LIMIT 5, 3;

注意:上面的查询也可以写成: SELECT * FROM NewUsers LIMIT 5, 3;

按条款分组 (GROUP BY Clause)

GROUP BY combines multiple records and groups them using one or more columns. For example, to count the number of users with a particular name we may enter the query:

GROUP BY合并多个记录,并使用一个或多个列对其进行分组。 例如,要计算具有特定名称的用户数量,我们可以输入查询:

SELECT Name, COUNT(Name) FROM NewUsers
GROUP BY Name;

有条款 (HAVING Clause)

If we need to specify a condition on groups we cannot use the WHERE clause because the WHERE clause specifies conditions on columns. To provide conditions on groups the HAVING clause is used. In the above example let us extract users with same names.

如果需要在组上指定条件,则不能使用WHERE子句,因为WHERE子句在列上指定条件。 为了提供组的条件,使用了HAVING子句。 在上面的示例中,让我们提取具有相同名称的用户。

SELECT Name, COUNT(Name) FROM NewUsers
GROUP BY Name HAVING COUNT(Name) > 1;

不同 (DISTINCT)

The DISTINCT keyword retrieves unique records. To fetch unique names enter the following query:

DISTINCT关键字检索唯一记录。 要获取唯一名称,请输入以下查询:

SELECT DISTINCT Name
FROM NewUsers ORDER BY Name;

附加和分离数据库 (Attaching and Detaching Databases)

When operating with multiple databases, an alias can be attached to each database. The ATTACH DATABASE command attaches a name to a database. Enter .databases. You will get a list of database names and their respective files. The main database is the primary database. Besides main, there is a temporary, hidden database temp. Both of these can neither be attached nor be detached from an alias. Let us attach Library.db to an alias LIB.

当使用多个数据库时,可以将别名附加到每个数据库。 ATTACH DATABASE命令将名称附加到数据库。 输入.databases 。 您将获得数据库名称及其各自文件的列表。 数据库是主数据库。 除了main之外,还有一个临时的隐藏数据库temp 。 这两个都不能附加或与别名分离。 让我们将Library.db附加到别名LIB

ATTACH DATABASE 'Library.db' AS 'LIB';

Consider another database Students.db. Attach it to STU.

考虑另一个数据库Students.db 。 将其附加到STU

ATTACH DATABASE 'Students.db' AS 'STU';

Enter .databases. You will get something like this:

输入.databases 。 您将获得如下内容:

Attach Database

The seq column does not have the record 1 between 0 and 2. It is actually the hidden database temp.

seq列在0到2之间没有记录1。它实际上是隐藏的数据库temp

Now you can execute queries on both databases in the same sqlite session. To select top ten records from LIB we may enter the following:

现在,您可以在同一sqlite会话中对两个数据库执行查询。 要从LIB中选择前十条记录,我们可以输入以下内容:

SELECT * FROM LIB.NewUsers
WHERE 1 LIMIT 10;

Suppose STU contains a table Students with the student names. We need to find out details of library users that are students (consider names to be a column in both Students and NewUsers for this example). We may enter the following query:

假设STU包含一个带有学生姓名的学生表。 我们需要找出作为学生的图书馆用户的详细信息(在此示例中,将名称作为Student和NewUsers中的一列考虑)。 我们可能输入以下查询:

SELECT LIB.NewUsers.Id, LIB.NewUsers.Name, LIB.NewUsers.Age
FROM LIB.NewUsers
INNER JOIN STU.Students
ON STU.Students.Name = LIB.NewUsers.Name;

To detach Library.db from its alias LIB enter the following:

要从其别名LIB分离Library.db ,请输入以下内容:

DETACH DATABASE 'LIB';

交易次数 (Transactions)

Once the database has been created we can perform queries to create and modify records in tables. One or more of these queries that change the previous state of the database give rise to a Transaction. So a transaction can include inserting, updating and deleting records. It also includes creation, modification and deletion of tables. A transaction can have several smaller executions inside – consider a bank’s database. A user withdraws money, their account status is updated, the bank’s status is updated, the log database gets a new record, etc – all this needs to happen flawlessly, otherwise the money will be missing in one table, creating a problem for everyone.

创建数据库后,我们可以执行查询以创建和修改表中的记录。 这些查询中的一个或多个更改数据库以前状态的查询将引起一个Transaction 。 因此,事务可以包括插入,更新和删除记录。 它还包括表的创建,修改和删除。 交易可以在内部执行多个较小的执行-考虑银行的数据库。 用户取钱,更新帐户状态,更新银行状态,日志数据库获得新记录等-所有这些都必须完美无缺地进行,否则,钱将丢失在一个表中,给每个人造成麻烦。

When you perform queries in the form of a transaction, the changes are not added directly to the database. You have to commit them yourself. This helps in case some error occurs or the system fails during a transaction. In such a situation, the database will not change its state and will not be left with partial changes.

当您以事务的形式执行查询时,所做的更改不会直接添加到数据库中。 您必须自己提交。 这有助于在事务期间发生某些错误或系统出现故障的情况。 在这种情况下,数据库将不会更改其状态,也不会留下部分更改。

SQLite is a Transactional database i.e. it is ACID compliant. ACID is an acronym for Atomicity, Consistency, Isolation and Durability. These terms are discussed below.

SQLite是一个事务数据库,即它符合ACID 。 ACID是原子性,一致性,隔离性和耐久性的首字母缩写。 这些术语在下面讨论。

Atomicity 原子性

Atomicity makes transactions indivisible. Either changes are committed all at once or the entire transaction fails.

原子性使交易不可分割。 要么一次全部提交更改,要么整个事务失败。

Consistency 一致性

Every transaction is consistent i.e. the final state reached after a transaction will also be a valid state.

每个事务都是一致的,即事务之后达到的最终状态也将是有效状态。

Isolation 隔离

Transactions are separated from one another in such a way that during their concurrent execution the failure of one will not affect the execution of others.

事务以一种方式彼此分离,使得在并发执行期间,事务的失败不会影响其他事务的执行。

Durability 耐用性

Once a transaction has been committed successfully, the changes in the database will be permanent and immune to any system failures.

一旦事务成功提交,数据库中的更改将是永久的,并且不受任何系统故障的影响。

SQLite offers commands to control transactions. The following table lists the control commands.

SQLite提供命令来控制事务。 下表列出了控制命令。

CommandDescription
BEGIN TRANSACTIONMarks the beginning of a transaction.
ROLLBACKErases current transaction. If it is used with the TO keyword, it rollbacks to a particular savepoint.
COMMITCommits a transaction to database. It is another alias for END TRANSACTION.
命令 描述
开始交易 标记交易的开始。
回滚 擦除当前交易。 如果与TO关键字一起使用,它将回滚到特定的保存点。
承诺 将事务提交到数据库。 它是END TRANSACTION的另一个别名。

Besides these there are two more commands: SAVEPOINT and RELEASE. SAVEPOINT is similar to BEGIN except that you must provide a name to the beginning transaction, thus allowing you to nest transactions. RELEASE removes a predefined savepoint and merges a named transaction into its parent transaction.

除了这些,还有两个命令:SAVEPOINT和RELEASE。 SAVEPOINT与BEGIN相似,不同之处在于您必须为开始的事务提供名称,从而允许您嵌套事务。 RELEASE删除预定义的保存点,并将命名的事务合并到其父事务中。

Let us continue with Library.db. Start a transaction by entering: BEGIN TRANSACTION;. Insert some valid records in the table:

让我们继续Library.db 。 输入以下内容开始交易: BEGIN TRANSACTION; 。 在表中插入一些有效记录:

INSERT INTO NewUsers VALUES (18, 'Frank', 'U140', 45, '2009-11-02');
INSERT INTO NewUsers VALUES (19, 'Claire', 'U141', 43, '2009-11-01');

To save these changes you may enter COMMIT;. Or if you want to discard them enter ROLLBACK;.

要保存这些更改,您可以输入COMMIT; 。 或者,如果您想丢弃它们,请输入ROLLBACK;

SAVEPOINT statement starts the transaction with a name. Create a savepoint named SPT1 and add a new record.

SAVEPOINT语句以名称开始事务。 创建一个名为SPT1的保存点,并添加一条新记录。

SAVEPOINT SPT1;
INSERT INTO NewUsers VALUES (20, 'Ricky', 'U142', 26, '2011-07-22');

Create another savepoint SPT2 and add another record.

创建另一个保存点SPT2并添加另一个记录。

SAVEPOINT SPT2;
INSERT INTO NewUsers VALUES (21, 'Sundar', 'U143', 31, '2011-09-21');

Both these savepoints are nested (SPT2 in SPT1). You can commit both of them by entering:

这两个保存点都是嵌套的(SPT1中的SPT2)。 您可以通过输入以下两个命令来提交它们:

RELEASE SAVEPOINT SPT1;

When RELEASE is applied on the outermost savepoint of the nested savepoints, it commits all the savepoints starting with the most recent one. Thus SPT2 and SPT1 both are committed.

当在嵌套保存点的最外面的保存点上应用RELEASE时,它将提交从最新保存点开始的所有保存点。 因此,SPT2和SPT1都已提交。

RELEASE SAVEPOINT SPT2; will release SPT2. But since it is child to the parent transaction SPT1, its fate depends on it. If SPT1 is rolled back so is SPT2.

RELEASE SAVEPOINT SPT2; 将发布SPT2。 但是由于它是父事务SPT1的子项,因此其命运取决于它。 如果SPT1回滚,SPT2也回滚。

To discard both of them, you can rollback to the outermost savepoint i.e. SPT1.

要丢弃它们两者,可以回滚到最外面的保存点,即SPT1。

ROLLBACK TO SAVEPOINT SPT1;

自动提交模式 (Autocommit mode)

If you execute queries without explicitly defining a transaction, each query is wrapped in its own transaction and then executed. You can think of it as each query with a particular BEGIN TRANSACTION and a COMMIT statement. This is the autocommit mode. Autocommit mode is switched on by default.

如果在没有显式定义事务的情况下执行查询,则每个查询都将包装在其自己的事务中,然后执行。 您可以将其视为具有特定BEGIN TRANSACTION和COMMIT语句的每个查询。 这是自动提交模式。 默认情况下,自动提交模式是打开的。

If you explicitly start a transaction, the autocommit mode is turned off. After a commit (or rollback) to the same transaction the autocommit mode is again turned on.

如果您明确启动事务,则将关闭自动提交模式。 在提交(或回滚)同一事务后,自动提交模式再次打开。

导出数据库 (Exporting Databases)

At the beginning of the tutorial we imported a table to the database using the .read command. To export a database or table we use the .dump command. .dump displays the database in SQL text format. You can use the redirection operator in the command line to save the dump to a file.

在本教程开始时,我们使用.read命令将表导入数据库。 要导出数据库或表,我们使用.dump命令。 .dump以SQL文本格式显示数据库。 您可以在命令行中使用重定向运算符将转储保存到文件中。

sqlite3 Library.db '.dump' > LibBackup.sql

If a file LibBackup.sql already exists, it is overwritten. The above command will dump the entire database to the file. You can optionally provide a table name as an argument to .dump. It will export that particular table. To dump NewUsers enter:

如果文件LibBackup.sql已经存在,它将被覆盖。 上面的命令会将整个数据库转储到文件中。 您可以选择提供一个表名作为.dump的参数。 它将导出该特定表。 要转储NewUsers,请输入:

sqlite3 Library.db '.dump NewUsers' > LibBackup.sql

输出结果 (Output Results)

By default the output generated through a query is written on the standard output. SQLite provides the .output command to write the output of one or more queries to a file.

默认情况下,通过查询生成的输出将写在标准输出上。 SQLite提供了.output命令,可将一个或多个查询的输出写入文件。

Enter .output output.txt and a few queries. The results will be written to output.txt stored in the current working directory. You can exit the sqlite session and view the file.

输入.output output.txt和一些查询。 结果将被写入当前工作目录中存储的output.txt中。 您可以退出sqlite会话并查看文件。

.output

.output stdout displays output to the standard output.

.output stdout显示为标准输出。

结论 (Conclusion)

We’ve learned about SQLite operators and expressions. The tutorial also includes transactions and a brief discussion about SQLite’s transactional nature. I hope you found it useful; if you have any questions feel free to ask them in the comments and I will do my best to answer them.

我们已经了解了SQLite运算符和表达式。 本教程还包括事务和有关SQLite事务性质的简短讨论。 希望你觉得它有用; 如果您有任何问题,请随时在评论中提问,我会尽力回答。



  1. .width sets column width for column mode. Provide the width of characters in comma separated values. e.g. .width 10, 20, 15

    .width设置列模式的列宽。 以逗号分隔的值提供字符的宽度。 例如.width 10, 20, 15

翻译自: https://www.sitepoint.com/sqlite-3-beyond-basics/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值