Sql file import database - Nanny level tutorial

catalogue

1: Preparation -.sql file

2: Open the created sql file in the editing tool - store the instructions and save

3: Right click to run SQL file

Open.sql file

Click start, and then click Close after loading

Click the table again - refresh - and you can see that all the required tables have been created

4: Export SQL script file in database

All records?

Select SQL script file?

Check it yourself and click next?

next step?

next step?

Click start?

Click save after loading?

Enter 111 (optional)?

Back on the desktop, you can see the exported sql file?

Drag the.sql file into the editor to view the relevant instructions

If you want to see the results and data of the table

Right click to select dump SQL file structure and data?

5: View relevant data in the table - right click - reverse table to model

Right click in main - reverse table to model - to view the relevant attributes of all tables

1: Preparation -.sql file

First, you can create a.text file on the desktop - --- modify the file to an.sql file (as follows)

2: Open the created sql file in the editing tool - store the instructions and save

/*
Navicat SQLite Data Transfer

Source Server         : school
Source Server Version : 30808
Source Host           : :0

Target Server Type    : SQLite
Target Server Version : 30808
File Encoding         : 65001

Date: 2021-12-23 16:06:04
*/

PRAGMA foreign_keys = OFF;

-- ----------------------------
-- Table structure for Course
-- ----------------------------
DROP TABLE IF EXISTS "main"."Course";
CREATE TABLE Course(
    courseid integer  primary key autoincrement,
    courseme varchar(32),
    teacherid int
);

-- ----------------------------
-- Records of Course
-- ----------------------------
INSERT INTO "main"."Course" VALUES (3001, 'language', 1001);
INSERT INTO "main"."Course" VALUES (3002, 'mathematics', 1002);

-- ----------------------------
-- Table structure for Mark
-- ----------------------------
DROP TABLE IF EXISTS "main"."Mark";
CREATE TABLE Mark(
    userid integer,
    courseid integer not null,
    score int default 0
);

-- ----------------------------
-- Records of Mark
-- ----------------------------
INSERT INTO "main"."Mark" VALUES (2001, 3001, 89);
INSERT INTO "main"."Mark" VALUES (2001, 3002, 90);
INSERT INTO "main"."Mark" VALUES (2002, 3001, 66);
INSERT INTO "main"."Mark" VALUES (2003, 3002, 85);



-- ----------------------------
-- Records of sqlite_sequence
-- ----------------------------
INSERT INTO "main"."sqlite_sequence" VALUES ('Teacher', 1002);
INSERT INTO "main"."sqlite_sequence" VALUES ('Student', 2002);
INSERT INTO "main"."sqlite_sequence" VALUES ('Course', 3002);

-- ----------------------------
-- Table structure for Student
-- ----------------------------
DROP TABLE IF EXISTS "main"."Student";
CREATE TABLE Student(
    userid integer  primary key autoincrement,
    username varchar(32),
    userage int,
    usersex varchar(32)
);

-- ----------------------------
-- Records of Student
-- ----------------------------
INSERT INTO "main"."Student" VALUES (2001, 'Xiao Ming', 18, 'male');
INSERT INTO "main"."Student" VALUES (2002, 'Xiaohong', 18, 'female');

-- ----------------------------
-- Table structure for Teacher
-- ----------------------------
DROP TABLE IF EXISTS "main"."Teacher";
CREATE TABLE Teacher(
    teacherid integer primary key autoincrement,
    teachername varchar(32)
);

-- ----------------------------
-- Records of Teacher
-- ----------------------------
INSERT INTO "main"."Teacher" VALUES (1001, 'Zhang San');
INSERT INTO "main"."Teacher" VALUES (1002, 'Li Si');

3: Right click to run SQL file

Open.sql file

Click start, and then click Close after loading

Click the table again - refresh - and you can see that all the required tables have been created

4: Export SQL script file in database

All records

Select SQL script file

Check it yourself and click next

next step

next step

Click Start

Click save after loading

Enter 111 (optional)

When you return to the desktop, you can see the exported sql file

Drag the.sql file into the editor to view the relevant instructions

If you want to see the results and data of the table

Right click to select dump SQL file structure and data

5: View relevant data in the table - right click - reverse table to model

Right click in main - reverse table to model - to view the relevant attributes of all tables

Tags: Android Interview Back-end Front-end

Posted by insub2 on Wed, 03 Aug 2022 22:17:13 +0530