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

Example Analysis of Database Table and SQL statement in SQL

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the example analysis of database tables and SQL statements in SQL, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.

Database table

A database usually contains one or more tables. Each table is identified by a name. The table contains records (rows) with data.

Id LastName FirstName Address City1 Adams John Oxford Street London2 Bush George Fifth Avenue New York3 Carter Thomas Changan Street Beijing

Note: a table named "Persons" contains three records (three people) and five columns (Id, last name, first name, address, and city).

SQL statement

Most of the work you need to do on the database is done by SQL statements. For example, select the data of the LastName column from the table:

SELECT LastName FROM Persons

Important matters

SQL is not case-sensitive!

The semicolon after the SQL statement? A semicolon is the standard way to separate each SQL statement in a database system.

Some database systems require a semicolon at the end of each SQL command, while others do not (such as MS Access).

SQL DML and DDL

SQL can be divided into two parts: data manipulation language (DML) and data definition language (DDL).

SQL (structured query language) is the syntax for executing queries, and the SQL language also contains syntax for updating, inserting, and deleting records.

Query and update instructions make up the DML part of SQL:

SELECT-get data from database tables

UPDATE-updates the data in the database table

DELETE-removes data from the database table

INSERT INTO-insert data into the database table

The DDL section of SQL can create or delete tables. You can also define indexes (keys), specify links between tables, and impose constraints between tables.

The most important DDL statement in SQL:

CREATE DATABASE-create a new database

ALTER DATABASE-modify the database

CREATE TABLE-create a new table

ALTER TABLE-change (change) database table

DROP TABLE-Delete the table

CREATE INDEX-create index (search key)

DROP INDEX-Delete the index

Thank you for reading this article carefully. I hope the article "sample Analysis of Database tables and SQL sentences in SQL" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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

Development

Wechat

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

12
Report