-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase.js
23 lines (17 loc) · 845 Bytes
/
database.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const mysql = require('mysql');
var mysqlConnection = mysql.createConnection({
host: 'localhost',
user: 'root',
password: 'sc123456',
});
mysqlConnection.query("CREATE DATABASE IF NOT EXISTS mydb35");
mysqlConnection.query("use mydb35");
var sql = "CREATE TABLE IF NOT EXISTS students (roll_no int not null,\
name varchar(50) not null,\
maths_marks int not null,\
physics_marks int not null,\
chemistry_marks int not null,\
total_marks int not null,\
percentage int not null)";
mysqlConnection.query(sql);
module.exports = mysqlConnection;