DB_基础

Posted mayixiaojie

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DB_基础相关的知识,希望对你有一定的参考价值。

//创建表:
CREATE TABLE t_myy
(id BIGINT(8) PRIMARY KEY , NAME CHAR(30) NOT NULL, birth DATE, dept VARCHAR(30),sex VARCHAR(2));
 
 
SELECT * FROM t_myy1
//插入表:
INSERT INTO t_myy1 (id, NAME, birth, dept, sex) VALUES ( 2,‘aaa‘, ‘2012-03-01‘, ‘SSS‘, ‘男‘);
 
//修改表:
UPDATE t_myy1 SET id= 1 WHERE id=2;
//删除表数据:
DELETE FROM t_myy WHERE id=1;
//删除表:
DROP TABLE t_myy
//截断表:
TRUNCATE TABLE t_myy2
//删除表数据:
DELETE FROM t_myy1
 
//删除表数据:
DELETE
FROM
t_teacher
WHERE id IS NULL ;
 
//删除表数据:
DELETE FROM t_teacher WHERE NAME LIKE ‘m%‘;
 
//插入表数据:
INSERT INTO t_teacher VALUES (33, ‘昝清龙‘, ‘女‘);
//插入表数据:
INSERT INTO t_teacher (NAME, sex) VALUES (‘mengyuanyuan‘, ‘女‘);
//插入表数据:
INSERT INTO t_teacher (NAME) VALUE (‘nnn‘);
 
//表内连接:
SELECT * FROM t_student A JOIN t_teacher B ON a.`name`=b.`name`;
 
 
//DUAL叫哑表, 判断真假:
SELECT 0=2 FROM DUAL
 
//修改表数据:
UPDATE
t_teacher
SET
id = 11
WHERE id = 11 ;
//修改表数据:
UPDATE t_student SET NAME =‘myy‘ WHERE NAME =‘孟园园‘;

以上是关于DB_基础的主要内容,如果未能解决你的问题,请参考以下文章

MySQL基础_简介

db2 基础语法

数据库版本管理工具Flyway——基础篇

python基础

MySQL_基础

Oracle表空间基础