In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
We have a section in the previous sections about the creation and addition of database sqlite files. Let's continue with that section. First of all, look at the picture: the data saved last time
Now we learn how to use SQL statements to add data.
There are two kinds of adding data, one is to add part of the data, the other is to add all the data.
Let's first look at adding some data, syntax:
Insert into table name (field name 1, field name 2) Values (value 1, value 2,)
The table name is the name of table. We are position. The field is the name of each item of data in the table. For example, X, Y, Z. The value is the value corresponding to the field (the order of the field name and value must correspond well).
Let's write down the example sentence under the SQL menu as shown in the picture
Then click "Execute". If there is no problem, it will be added. Then select the data menu and click on the table position. As shown in the picture
The second line is our newly added data. Because only the x and y fields have been added. So everything else is null.
There is no distinction between upper and lower case letters in the code. But the words can not be written wrong, otherwise the addition will not be successful. That kind of situation is basically caused by word errors.
Next, let's add all the data. Syntax:
Insert into table name values (1 value, 2 value.)
There is no need to write the field name, just assign all the values. But be aware that all values are assigned.
The example sentence is as follows
Also click "Excute". Don't make a mistake. Then select data and click on the table position.
As shown in the picture
Next, let's look at the statement syntax for deleting data:
Delete from table name where (condition)
Condition is based on what to delete, for example, x = 2.5. The example sentences are as follows
After clicking OK
The data in the second row has been deleted.
Next, let's learn the sentence syntax for changing the data:
Update table name set field name = "new value" where field name = "old value"
Example:
And then
Finally, we learn the sentence syntax for querying data. There are also two kinds of this.
Query partial data statement syntax:
Select field name from table name where (field name = some value)
Query the value of a field name in the table according to the condition
As shown in the picture
The result we found is cube, correct.
Finally, we learn the sentence syntax for querying all data:
Select * from table name where field name = a value
Note that the "*" number must be available. The example sentences are as follows
We find out all the data for the row based on the value of a field name.
That's what we're talking about in this section. In the next section, we will discuss how to add, delete, modify and query the database in unity.
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.