SpringBoot记录

1、数据库操作

【SpringBoot记录】show databases;
use ;
show DATABASES ; use spiders; show tables ; select *from user; CREATE TABLE `Testtable` ( `test_id` BIGINT(32) NOT NULL AUTO_INCREMENT COMMENT '测试ID', `test_name` VARCHAR(255) NOT NULL COMMENT '测试名称', `test_source` VARCHAR(255) DEFAULT NULL COMMENT '客户来源', `test_phone` VARCHAR(255) DEFAULT NULL COMMENT '客户电话', `test_level` VARCHAR(255) DEFAULT NULL COMMENT '客户级别', PRIMARY KEY (`test_id`) ) ENGINE =INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; select *from Testtable; #增加列 ALTER TABLE Testtable ADD columnName varchar(30); #修改列名称 ALTER TABLE Testtable CHANGE columnName test_columnName VARCHAR(30); #删除列 ALTER TABLE Testtable DROP COLUMN test_columnName; #批量修改 ALTER TABLETesttable CHANGE test_id test_Id BIGINT(12) NOT NULL , CHANGE test_name test_Name VARCHAR(32) NOT NULL , CHANGE test_source test_Source VARCHAR(32) NOT NULL; INSERT INTO Testtable(test_Id, test_Name, test_Source, test_phone, test_level) VALUES ('1', '孔陈亮','易二三', '13143433764', 'iOS开发工程师'); mysql> show databases; +--------------------+ | Database| +--------------------+ | information_schema | | mysql| | performance_schema | | spiders| | sys| +--------------------+ 5 rows in set (0.06 sec)mysql> use spiders; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changed mysql> show tables; +-------------------+ | Tables_in_spiders | +-------------------+ | student| | user| +-------------------+ 2 rows in set (0.00 sec)mysql> select *form student; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'form student' at line 1 mysql> select *from student; +------------+------+-----+ | id| name | age | +------------+------+-----+ | 2019092501 | kcl|28 | +------------+------+-----+ 1 row in set (0.00 sec)mysql>

//只需要类添加 @RestController 即可,默认类中的方法都会以 json 的格式返回 @RestController public class HelloController {@RequestMapping(value = "https://www.it610.com/hello", method = RequestMethod.GET) public String say() { return "Hello Spring Boot"; } }

    推荐阅读