当前位置:网站首页>Basic knowledge of database
Basic knowledge of database
2022-07-20 11:09:00 【lucky_ starr】
Databases are everywhere in our life , Whether you look up your name in email , Search on the website or use it at the ATM ATM card , We have been using databases .
A database is a collection of data stored in an organized way , It's a container for organized data ( Usually a file or group of files ).
Catalog
Two . Column (column) And data types
One . surface (table)
If the database is regarded as a file cabinet . When we put information in the filing cabinet , We can't put , Otherwise, it will be hard to find in the future , We need to set the classification of documents , Put the corresponding data into a specific file .
In the database , This file is called a table . Is a structured list of certain types of data . It can be regarded as a set of specific partitions . The nature of the same table should be the same , The data stored in the table searches for the same type of data or list . Like in school , We should build two different tables for teachers and students , Otherwise, it will be difficult to retrieve and access in the future .
Each table in the same database has a unique table name , However, the same table name can be used in different databases .
How data is stored in tables , What data to store . How to decompose data . Are described by patterns . Schemas are information about the layout and characteristics of databases and tables .
Two . Column (column) And data types
Table consists of columns , Columns store some information in the table . A column is a field in a table .
In fact, columns can be said to be obtained by decomposing data , For a student object , full name , Gender , Student number , Are the corresponding columns . By decomposing data , We can use Specific columns classify and filter data .
Each list has a corresponding number According to the type , It limits the kind of data stored in this column . If there are numbers in the column , The data type should be numeric .
What's the use of data types ?
It can prevent illegal input , For example, enter character values in the numeric field . It also helps to classify data correctly , Optimize the use of disks .
3、 ... and . That's ok (row)
The data in the table is stored by row . If the column is the attribute of the object storing this table , So every The row is the corresponding object , Such as storing students , List names , Student number , Gender , Then every line is a student .
Four . Primary key (KEY)
A column of ( Or a set of columns ), Its value uniquely identifies each row in the table . For example, the student number of each student , Everyone's ID card . There is no primary key , It is difficult to update and delete specific lines , Because you can't guarantee not to involve other industries , For example, delete students by name , You can't guarantee whether someone has a duplicate name . Defining a primary key is conducive to future data operation and management .
Want a column as the primary key , It should meet the following conditions :
1. The primary key of each row is unique .
2. Each row has a primary key .
3.. The value of primary key cannot be modified .
4 Primary key values cannot be reused ( If it's deleted , Its primary key cannot be assigned to new rows in the future )
A primary key can be a column , You can also combine multiple columns as primary keys , The combination of all columns must be unique ( But a single column can not be unique ).
边栏推荐
- Modelsim reported an error "instance of '* * * *' failed. the design unit was not found."
- Summary of important knowledge points of management
- Pikachu靶场-SQL注入-字符型注入(get)过关步骤
- Design of a simple DDS signal generator based on FPGA
- ORC索引的位置信息
- JS object properties
- JS operation properties, styles and events
- 8day
- Impala查询卡顿分析案例
- Apache impala 4.1 overview
猜你喜欢
随机推荐
Apache impala 4.0 overview
【英雄哥七月集训】第 18天:树
Pikachu shooting range SQL injection digital injection (post) clearance steps
New features and community progress of impala 3.4
6day
MySQL InnoDB engine (4)
Verilog grammar basics HDL bits training 01
FPGA data receiving and sending and data loopback experiment based on serial port RS232
GC tuning principle of JVM (13)
使用 PyCharm 设置虚拟环境
JS定时器及Swiper插件
15day
unity性能优化方向
redisson分布式锁续期因为网络原因失败了,导致业务还在执行但锁没续期而自动释放了。
5day
MySQL手动注入步骤
JS operation properties, styles and events
Impala shell Caton analysis -- a tortuous debugging experience
Impala's question answer about a code of valuetransfergraph
预计iPhone14获中国消费者热捧,苹果和富士康给中国员工发钱,最高近万元