Initial knowledge of SQLITE3 database _sqlite

Source: Internet
Author: User
Tags sqlite

Database, we have not contacted the database, then what is the database?

It is a structured, integrated, shareable collection of data for unified management!

The so-called structured, refers to the data is organized according to a certain model.

To put it simply, take a box and separate it with a partition, so the box is divided into many squares, so we put the data in like landfills! OK, so just assemble the data, and some people say it's better to use the structure? But don't forget, the boxes can also be sorted and stored. This is not what the structure can do!

The so-called integration, refers to the database centralized storage of various types of data.

As I said above, the boxes gather the scattered data together!

And you can clean out all the extra stuff in this box, right?

The benefits of such centralized storage are obvious:

(1) A data need only one backup, less repetitive storage, that is, eliminate the redundancy of data.

(2) There is no data redundancy, it can guarantee the consistency of data.

sharing refers to the fact that data in a database can be used by different users. that is, each user can access the same database at their own request.

The so-called unified management, refers to the database by the DBMS Unified management, any data access through the DBMS to complete.

Shared and unified management I will not say, a box of course can be used for other people, as long as you do not lock!

Just now we have seen a new word: DBMS

What is this thing?

In fact, his full name is DB Management system database management Systems

is a kind of commodity software used to manage databases.
All requests to access the database are done by the DBMS.
The DBMS provides a number of commands (languages) for manipulating databases, the SQL language.
The official explanation is very complex, what application layer, language translation processing, data access layer and so on! Well, I really hate this, so I have to give you reduced to explain!

Through the above figure, do you see what's going on? How straightforward! But someone's going to ask, how about management? That's our SQL statement! Of course, in Linux will never use a very large database, so we just grasp some basic statements on it!

SQL statement I will be in the back of the blog to do the corresponding induction!

Did you talk about database management? But we also need to know what the database is, right?

Oracle do not need to say, we basically have heard this database! Features are: Support multi-language, excellent parallel processing capabilities, more for the financial, insurance and other industries
SQL Server Microsoft products, a good database management system, the best should be now Microsoft to promote cloud services, not to deceive everyone, I built on Azure server, with that is it! Integration is excellent, although I am not very good at using it!
DB2, this is also a database I have rarely contacted! Just know it's transplant is very good!
ACCESS is not much to say, office has, graphical interface is simple to operate
Sqlite3 Minimal database, etc will be my protagonist!
OK, these 5 database types have been introduced to you!

The database also has a very important concept: the data Model

It's actually a combination:

(1) Data structure/type value, etc.

(2) Data operation//traversal deletion, etc.

(3) Data integrity constraints//a certain relationship connection

There are 4 major categories

Hierarchical Data Model
Mesh Data Model
Relational Data Model
Object-oriented Database model
I will talk about relational data, because this is the focus, as for the other, you want to understand can Baidu, object-oriented model seems to have only recently fire, with not a lot!

As is known to all, when you enter the school, what will the school define for you? School Number! Yes, so the study number and your name, grades and other types of information exist, find the school number is to find all your information, this is the relationship model!

So how does it guarantee the independence of the data? That depends on how the database is structured!

The three-level pattern structure of database system refers to that the database system is composed of the outer mode, the mode and the internal mode level three. But I'm not going to say this, because I also feel some fear of this abstraction, in fact, in the development process, we do not have to understand him, even if I go to an interview, if the examiner asked me, I will tell him directly, I do not know, ni, I do not want to create a database of people! People do not have to tangle with it, I mention it means to know on the line!

There is still the candidate key in the database, the primary key what, do not care about it, this wait until we use SQL Server time to use it! Just remember a little: the school number is your primary key! Unique identifier!

And why do I have to choose to use sqlite3 as embedded database?

Because it's small! Size fits! The embedded thing space is limited, use it to do the data just right!
High portability, embedded I don't say much, must have transplant!
The programming interface is simple, the simple programming I can use it! What do you need it for?
Code open source, cost savings that is necessary! Otherwise do what embedded Ah!

What are the specific advantages? Baidu a bit!

The

SQLite Advantage
Small
Transaction operations are atomic, consistent, isolated, and persistent (ACID) even after system crashes and power failures.
Acid compatibility (atomicity, consistency, independence, durability), supporting views, subqueries, triggers
A single library file contains the database engine and interface, and its operation is not dependent on other libraries
can put data into a single file
provides interfaces for applications such as C + +, PHP, etc.
Free
allows you to dynamically add custom functions (simple functions and aggregate functions) to the SQL command set without renumbering the SQLite library
Improved B-tree. For table using B + tree, greatly improve query efficiency.
Well, today I wrote this, so hungry, I'm going to eat! I'll write sqlite3 installation and SQL syntax!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.