SQL学习笔记二 创建表、插入数据的语句
SQL学习笔记二 创建表、插入数据的语句,需要的朋友可以参考下。
创建一个表T_Employee并插入若干数据代码如下:
create table T_Employee(FNumber VARCHAR(20),FName VARCHAR(20),FAge int,FSalary NUMERIC(10,2) ,PRIMARY KEY(FNumber));
insert into T_Employee(FNumber,FName,FAge,FSalary) values('DEV001','Tom',25,8300);
insert into T_Employee(FNumber,FName,FAge,FSalary) values('DEV002','Jerry',28,2300.80);
insert into T_Employee(FNumber,FName,FAge,FSalary) values('SALES001','John',23,5000);
insert into T_Employee(FNumber,FName,FAge,FSalary) values('SALES002','Kerry',28,6200);
insert into T_Employee(FNumber,FName,FAge,FSalary) values('SALES003','Stone',22,1200);
insert into T_Employee(FNumber,FName,FAge,FSalary) values('HR001','Jane',23,2200.88);
insert into T_Employee(FNumber,FName,FAge,FSalary) values('HR002','Tina',25,5200.36);
insert into T_Employee(FNumber,FName,FAge,FSalary) values('IT001','Smith',28,3900);
insert into T_Employee(FNumber,FAge,FSalary) values('IT002',27,2800);
大家可以查找下 create与insert命令的使用。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Can'tcreatetable'table_name';tableexists-How to solve MySQL error: Unable to create table, table already exists, need specific code examples MySQL is one of the most commonly used relational databases and has a wide range of applications. When using MySQL, you sometimes encounter the error message: "Can'tcreatetable'table_name';tableexists", which means that it cannot be created.

Use MySQL to create a comment table to implement the comment function 1. Overview In many websites and applications, the comment function is an essential part. In order to implement the comment function, we need to create a comment table to store the user's comment content. This article will introduce how to use a MySQL database to create a review table and provide corresponding code examples. 2. Create a comments table. We can use the following SQL statement to create a comments table named comments: CREATETABLEcomments(id

MySQL creates an article table to implement the article function of the blog system. With the rapid development of the Internet, blogs have become an important platform for people to share knowledge, express opinions, and record their lives. In the blog system, the article function is one of the core. This article will introduce how to use MySQL database to create an article table to implement the article function in the blog system, and provide relevant code examples. 1. Create an article table In the MySQL database, you can use the CREATETABLE statement to create an article table. The article table needs to contain some basic fields, such as

Can'tcreatetable'table_name'(errno:150)-How to solve MySQL error: Unable to create table, error number: 150, specific code examples are needed When using MySQL database, sometimes you will encounter problems with creating tables. One of the common problems is that the table cannot be created with error number 150. This error usually indicates a foreign key constraint error when creating the table. This article explains how to solve this problem and provides specific code examples.

How to implement the statement of inserting data in MySQL? When using a MySQL database, inserting data is a very basic and common operation. By inserting data, new records can be added to database tables to provide support for business operations. This article will introduce how to use the INSERT statement in MySQL to implement data insertion operations, and provide specific code examples. The INSERT statement in MySQL is used to insert new records into the database table. Its basic syntax format is as follows: INSERTINTOt

How to implement the statement to create a table in MySQL? In the MySQL database, creating a table is one of the most important operations. The statement to create a table needs to take into account various factors such as the table structure, field types, constraints, etc. to ensure the accuracy and completeness of data storage. The following will introduce in detail how to create a table statement in MySQL, including specific code examples. First, we need to connect to the MySQL database server. You can use the following command to connect: mysql-uusername-p Next, enter the password

PHP and PDO: How to Insert Data into a MySQL Database Overview: This article will introduce how to use PHP's PDO extension to insert data into a MySQL database. PDO is a database access abstraction layer for PHP that can interact with a variety of databases, including MySQL. Steps: Connect to MySQL database: Before inserting data using PDO, we need to establish a connection with the MySQL database first. Below is a sample code showing how to connect to a MySQL database. //Set the number

PHP uses the mysql_query function to insert data into an existing MySQL table. This function takes two parameters and returns TRUE on success and FALSE on failure. Its syntax is as follows - Syntax boolmysql_query(sql,connection); Following are the parameters used in this function -S. Numbered parameters and descriptions 1. Sql required - SQL query used to insert data into an existing MySQL table 2. Connection optional - if not specified, the last opened connection by mysql_connect will be used.
