sql

 avatar
anhhackta
mysql
a month ago
2.4 kB
4
Indexable
Never
/*
 Navicat MySQL Data Transfer

 Source Server         : Xampp SQL
 Source Server Type    : MySQL
 Source Server Version : 100428 (10.4.28-MariaDB)
 Source Host           : localhost:3306
 Source Schema         : test

 Target Server Type    : MySQL
 Target Server Version : 100428 (10.4.28-MariaDB)
 File Encoding         : 65001

 Date: 25/01/2024 19:35:11
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for lop
-- ----------------------------
DROP TABLE IF EXISTS `lop`;
CREATE TABLE `lop`  (
  `LopID` int NOT NULL,
  `TenLop` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  PRIMARY KEY (`LopID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of lop
-- ----------------------------
INSERT INTO `lop` VALUES (1, 'CNTT');
INSERT INTO `lop` VALUES (2, 'TOAN');
INSERT INTO `lop` VALUES (3, 'HOA HOC');

-- ----------------------------
-- Table structure for sinhvien
-- ----------------------------
DROP TABLE IF EXISTS `sinhvien`;
CREATE TABLE `sinhvien`  (
  `MASV` int NOT NULL,
  `TenSV` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `NamSinh` int NULL DEFAULT NULL,
  `LopID` int NULL DEFAULT NULL,
  PRIMARY KEY (`MASV`) USING BTREE,
  INDEX `FK_LopID`(`LopID` ASC) USING BTREE,
  CONSTRAINT `FK_LopID` FOREIGN KEY (`LopID`) REFERENCES `lop` (`LopID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of sinhvien
-- ----------------------------
INSERT INTO `sinhvien` VALUES (1, 'Nguyen Van A', 1990, 1);
INSERT INTO `sinhvien` VALUES (2, 'Nguyen Van B', 1991, 1);
INSERT INTO `sinhvien` VALUES (3, 'Nguyen Van C', 1980, 2);
INSERT INTO `sinhvien` VALUES (4, 'Nguyen Van D', 1976, 3);
INSERT INTO `sinhvien` VALUES (5, 'Nguyen Van E', 1990, 2);
INSERT INTO `sinhvien` VALUES (6, 'Nguyen Van f', 1954, 3);
INSERT INTO `sinhvien` VALUES (7, 'Nguyen Van G', 1967, 1);
INSERT INTO `sinhvien` VALUES (8, 'Nguyen Van H', 1978, 1);
INSERT INTO `sinhvien` VALUES (9, 'Nguyen Van I', 1991, 2);
INSERT INTO `sinhvien` VALUES (10, 'Nguyen Van K', 2000, 3);

SET FOREIGN_KEY_CHECKS = 1;
Leave a Comment