Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the basic knowledge of the database?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

What this article shares with you is what is the basic knowledge of the database. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it with the editor.

Each table in the database should have a primary key

Database introduction Primary key each table should have one primary key, and each table can only have one primary key. Primary key column cannot contain NULL value what is SQLSQL, refers to the structured query language, the full name is StructuredQueryLanguage. SQL is a standard computer language for accessing and processing databases. SQL can create new databases, tables, stored procedures, and views. Insert, update, and delete records in the database. Retrieve data from the database, etc. Syntax rules can have multiple queries ending with a semicolon. Not strict partition case. In SQL, spaces and line breaks are ignored, but it is recommended that you avoid unnecessary spaces and blank lines.

SQL query commonly used query SHOWDATABASES

Query all database use database names; use a database SHOWTABLES query all tables SHOWCOLUMNSFROM table names query all columns SELECT columns FROM table names query SELECT column 1, column 2...FROM table names multi-column query SELECT*FROM table names all query DISTINCTDISTINCT keywords are used to return unique different values. The DISTINCT keyword is used in conjunction with SELECT to remove all duplicate records and return only unique records. SELECTDISTINCT column FROM table name

For example, the city where the customer is located in the query table is usually repeated. Using distinct, you can return a list of cities that do not repeat.

The LIMITLIMIT keyword is used to retrieve a subset of records SELECT column FROM table LIMIT3; returns the first three records. The SELECT column FROM table LIMIT2,4; (offset selection) selects four records from the second position.

Note: the subscript of the offset selection starts at 0, and in the above example, it starts from the second position, that is, from the third data.

Fully qualified name SELECT column name FROM table name;-- normal SELECT table name. Column name FROM table name;-- the above two sql statements are completely equivalent. This is especially useful when using multiple tables that may share the same column name. Sort

SELECT column name FROM table name ORDERBY column name

Sort by column name. The ORDERBY keyword sorts records by default in ascending order ASC. If you need to sort records in descending order, you can use the DESC keyword.

The above is what the basic knowledge of the database has, and the editor believes that some of the knowledge points may be seen or used in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report