Mysq_知识总结05(对表的格式、内容的更改)
USE jdbc_01;//自己建立的数据库
SHOW TABLES;
SELECT *FROM student;
DESC student;
ALTER TABLE student ADD address VARCHAR(20);
UPDATE student SET address = '陕西延安' ;
UPDATE student SET address = '陕西宝鸡' WHERE id = 4;
ALTER TABLE student CHANGE COLUMN age gender VARCHAR(2);
INSERT INTO student(NAME,gender,addess) VALUES('代','男','陕西延安');
UPDATE student SET gender = '女' WHERE id = 4;
DELETE FROM student WHERE id = 6;
INSERT INTO student(NAME)VALUES('daihu')
CREATE TABLE user_list (
id INT PRIMARY KEY AUTO_INCREMENT,
NAME VARCHAR(20) NOT NULL,
PASSWORD VARCHAR(20) NOT NULL);
DELIMITER $
CREATE PROCEDURE testIn(IN n INT)
BEGIN
SELECT * FROM student WHERE id = n;jdbc_01
END $
DELIMITER $
CREATE PROCEDURE testOut(OUT n VARCHAR(20))
BEGIN
SET n = '大家好,这是什么歌';
END $
SELECT COUNT(*) FROM student;
CREATE TABLE news (
id INT,
NAME VARCHAR(20),
address VARCHAR(20)
);
SELECT *FROM news;
CREATE TABLE daihu (
title VARCHAR(20),
content VARCHAR(20)
);
SELECT * FROM daihu;
SHOW TABLES;
SELECT *FROM student;
DESC student;
ALTER TABLE student ADD address VARCHAR(20);
UPDATE student SET address = '陕西延安' ;
UPDATE student SET address = '陕西宝鸡' WHERE id = 4;
ALTER TABLE student CHANGE COLUMN age gender VARCHAR(2);
INSERT INTO student(NAME,gender,addess) VALUES('代','男','陕西延安');
UPDATE student SET gender = '女' WHERE id = 4;
DELETE FROM student WHERE id = 6;
INSERT INTO student(NAME)VALUES('daihu')
CREATE TABLE user_list (
id INT PRIMARY KEY AUTO_INCREMENT,
NAME VARCHAR(20) NOT NULL,
PASSWORD VARCHAR(20) NOT NULL);
DELIMITER $
CREATE PROCEDURE testIn(IN n INT)
BEGIN
SELECT * FROM student WHERE id = n;jdbc_01
END $
DELIMITER $
CREATE PROCEDURE testOut(OUT n VARCHAR(20))
BEGIN
SET n = '大家好,这是什么歌';
END $
SELECT COUNT(*) FROM student;
CREATE TABLE news (
id INT,
NAME VARCHAR(20),
address VARCHAR(20)
);
SELECT *FROM news;
CREATE TABLE daihu (
title VARCHAR(20),
content VARCHAR(20)
);
SELECT * FROM daihu;