· 4 years ago · Apr 29, 2021, 05:46 AM
1-- create and select the database
2DROP DATABASE IF EXISTS mma;
3CREATE DATABASE mma;
4USE mma;
5
6-- create the Product table
7CREATE TABLE Product (
8 ProductID INT PRIMARY KEY AUTO_INCREMENT,
9 Code VARCHAR(10) NOT NULL UNIQUE,
10 Description VARCHAR(255) NOT NULL,
11 ListPrice DECIMAL(10,2) NOT NULL
12);
13
14-- insert some rows into the Product table
15INSERT INTO Product VALUES
16(1, 'java', 'Murach''s Java Programming', '57.50'),
17(2, 'jsp', 'Murach''s Java Servlets and JSP', '57.50'),
18(3, 'mysql', 'Murach''s MySQL', '54.50'),
19(4, 'android', 'Murach''s Android Programming', '57.50'),
20(5, 'html5', 'Murach''s HTML5 and CSS3', '54.50'),
21(6, 'oracle', 'Murach''s Oracle and PL/SQL', '54.50'),
22(7, 'javascript', 'Murach''s JavaScript and jQuery', '54.50');
23
24-- create a user and grant privileges to that user
25GRANT SELECT, INSERT, DELETE, UPDATE
26ON mma.*
27TO mma_user@localhost
28IDENTIFIED BY 'sesame';