Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Trevor Austin
/
mpcs-52553-austin-winter-2021
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
896402de
authored
Mar 03, 2021
by
Trevor Austin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish example
parent
b5ab49f3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
week_8/examples/posts_and_comments/20210303T143000-create_combines_table.sql
week_8/examples/posts_and_comments/20210303T145000-copy_old_data_over.sql
week_8/examples/posts_and_comments/20210303T143000-create_combines_table.sql
View file @
896402de
...
...
@@ -17,9 +17,9 @@ use weblog;
create
table
posts_and_comments
(
id
INT
AUTO_INCREMENT
PRIMARY
KEY
,
body
TEXT
,
slug
VARCHAR
(
30
)
NOT
NULL
,
title
VARCHAR
(
255
)
NOT
NULL
,
body
TEXT
NOT
NULL
,
slug
VARCHAR
(
30
),
title
VARCHAR
(
255
),
post_id
INT
,
author
VARCHAR
(
30
)
)
)
;
week_8/examples/posts_and_comments/20210303T145000-copy_old_data_over.sql
0 → 100644
View file @
896402de
-- migrate the posts first
use
weblog
;
insert
into
posts_and_comments
(
id
,
body
,
slug
,
title
)
SELECT
id
,
body
,
slug
,
title
from
posts
;
-- then migrate the comments
insert
into
posts_and_comments
(
body
,
author
,
post_id
)
select
body
,
author
,
post_id
from
comments
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment