Blogger Information
Blog 20
fans 0
comment 0
visits 25107
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
navicat数据库的建立与操作
左手Leon的博客
Original
1101 people have browsed it

建立了一张关于汽车型号与配置的表“car”

设计了对应的字段为“id”“名称”“***”“类型”“能源类型”“尺寸”“发动机功率”“油箱容积”“重量”“排气量”“核载人数”

另外,对于数据中字段的类型与长度等,需要还需要另作一份博客说明


1、设计表格

SQL-01-表格设计.png

2、数据内容

SQL-02-数据内容.png


3、插入数据

SQL-03-插入数据.png

4、删除数据

SQL-04-删除数据.png

5、查询数据

SQL-05-查询数据.png

6、修改数据

SQL-06-修改数据.png


数据库car

实例

/*
Navicat MySQL Data Transfer

Source Server         : testSite
Source Server Version : 50553
Source Host           : localhost:3306
Source Database       : cars

Target Server Type    : MYSQL
Target Server Version : 50553
File Encoding         : 65001

Date: 2019-03-21 17:43:11
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for car
-- ----------------------------
DROP TABLE IF EXISTS `car`;
CREATE TABLE `car` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(20) DEFAULT NULL COMMENT '汽车型号',
  `brand` varchar(20) DEFAULT NULL COMMENT '***',
  `type` varchar(20) DEFAULT NULL COMMENT '汽车类型',
  `energy` tinyint(1) unsigned DEFAULT NULL COMMENT '0汽油 1柴油 2新能源',
  `size` varchar(20) DEFAULT NULL COMMENT '尺寸长*宽*高',
  `hp` smallint(3) unsigned DEFAULT NULL COMMENT '发动机功率',
  `tank` smallint(3) unsigned DEFAULT NULL COMMENT '油箱容积',
  `weight` smallint(4) unsigned DEFAULT NULL COMMENT '整车重量',
  `displacement` smallint(4) unsigned DEFAULT NULL COMMENT '排量',
  `number` tinyint(1) unsigned DEFAULT NULL COMMENT '核定人数',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of car
-- ----------------------------
INSERT INTO `car` VALUES ('1', '速腾', '大众', '紧凑', '0', '4753*1800*1462', '116', '55', '1330', '1200', '5');
INSERT INTO `car` VALUES ('3', '宝马7', 'BMW', '大型', '1', '5250*902*1498', '258', '78', '1830', '1998', '5');
INSERT INTO `car` VALUES ('4', '奥德赛', '广汽本田', 'MPV', '0', '4845*1802*1697', '186', '55', '1774', '2356', '7');
INSERT INTO `car` VALUES ('5', 'smart', 'BMW', '微型', '2', '2695*1663*1555', '71', null, null, null, '4');

运行实例 »

点击 "运行实例" 按钮查看在线实例


Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!