Home > Database > Mysql Tutorial > body text

What is SQL

藏色散人
Release: 2018-12-04 15:58:19
Original
6553 people have browsed it

Sql (STructured Query Language) is a universal language for managing all database operations. It is a database query and programming language that can be used to access data and query, update and manage relational databases. system. Different SQL commands can be used to manage different database functions. SQL is also the extension of the database file format.

What is SQL

What is SQL

SQL (Structured Query Language) is one of the important tools for programmers One, it is part of the database management tool. Different vendors provide different databases. For web applications, the commonly used ones are MSSQL, MySQL, MS Access. The Oracle database is relatively popular among enterprise users. The combination of PHP and MySQL is arguably the most popular among current web applications.

Scripts and SQL in the database

Let’s introduce some basic SQL commands through simple sql scripts.

First query to create a table to store our student records, and then we use the insert query to add a small number of records.

The SQL command is as follows:

Create student table

CREATE TABLE student ( id int(2) NOT NULL auto_increment,  name varchar(50) NOT NULL default '', 
class varchar(10) NOT NULL default '', mark int(3) NOT NULL default '0', 
UNIQUE KEY id (id) ) TYPE=MyISAM;
Copy after login

We can see that there are three fields in the table. One is the id, which is an auto-increment that will take on a unique number every time a record is added to the table. The next field is a 50-byte name that stores the student's name. Next is the 10-length class field, which represents the class field.

Add records

Add some data to the above table. The SQL statement to insert data is as follows:

INSERT INTO student VALUES (1, 'John Deo', 'Four', 75);
INSERT INTO student VALUES (2, 'Max Ruin', 'Three', 85);
INSERT INTO student VALUES (3, 'Arnold', 'Three', 55);
INSERT INTO student VALUES (4, 'Krish Star', 'Four', 60);
INSERT INTO student VALUES (5, 'John Mike', 'Four', 60);
INSERT INTO student VALUES (6, 'Alex John', 'Five', 55);
Copy after login

You can also copy and paste this SQL code in the SQL window to insert some records into the table.

This SQL code means inserting six records into the student table. Then a simple SQL table has been successfully created.

This article is a brief introduction to what SQL is. I hope it will be helpful to friends in need!

The above is the detailed content of What is SQL. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template