Inserting Table

Here's a sample table:

id

creator_id

time_stamp

total_amount

completion

remaining_amount

1

1

01/02/2019

300.00

1

0

2

3

01/02/2019

123.12

1

0

3

4

10/03/2020

326.12

1

0

4

1

08/15/2018

32626.11

0

30020.11

5

2

07/27/2020

3234.33

1

0

6

2

03/11/2019

4000.00

0

3521.94

7

1

01/19/2020

559.11

0

193.22

Always, you start with choosing the right database.

mysql> USE EBIS3003;

Then, I drop the table I created from the last assignment. This is necessary because the old one and the new have different constraints.

mysql> DROP TABLE IF EXISTS projects_kick;

Then, create the new table.

mysql> CREATE TABLE projects_kick (
				  id INT NOT NULL,
				  creator_id INT NOT NULL,
	        timestamp VARCHAR(255) NOT NULL,
					total_amount DECIMAL(10,3) NULL,
					completion INT NOT NULL,
					remaining_amount DECIMAL(10,3) NULL,

					CONSTRAINT projects_key PRIMARY KEY(id));

Now, insert the data:

mysql> INSERT INTO projects_kick VALUES(
				1,1,"01/02/2019",300.00, 1, 0);
mysql> INSERT INTO projects_kick VALUES(
				2,3,"01/02/2019",123.12, 1, 0);
mysql> INSERT INTO projects_kick VALUES(
				3,4,"10/03/2020",326.12, 1, 0);
mysql> INSERT INTO projects_kick VALUES(
		    4,1,"08/15/2018",32626.11, 0, 30020.11);
mysql> INSERT INTO projects_kick VALUES(
	      5,2,"07/27/2020",3234.33, 1, 0);
mysql> INSERT INTO projects_kick VALUES(
	      6,2,"03/11/2019",4000.00, 0, 3521.94);
mysql> INSERT INTO projects_kick VALUES(
	      7,1,"01/19/2020",559.11, 0, 193.22);

Last updated

Was this helpful?