# Join tables - how to join these tables help

**URL:** <https://forum.freecodecamp.org/t/join-tables-how-to-join-these-tables-help/478347>\
**Category:** General\
**Created:** [September 18, 2021, 6:05pm UTC](https://forum.freecodecamp.org/t/join-tables-how-to-join-these-tables-help/478347 "2021-09-18T18:05:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![g\_yze](https://avatars.discourse-cdn.com/v4/letter/g/e274bd/32.png) [@g\_yze](https://forum.freecodecamp.org/u/g_yze)\
**Post date:** [September 18, 2021, 6:05pm UTC](https://forum.freecodecamp.org/t/join-tables-how-to-join-these-tables-help/478347/1 "2021-09-18T18:05:46Z")

</div>

can anyone help me here - how do I join these two tables? I have tried but I’m stuck.  
Thank you so much 🙏

```sql
drop database if exists quiz; 
create database quiz; 
USE quiz; 
CREATE TABLE spm (ID int auto_increment, Tekst varchar (500), primary key(ID));
CREATE TABLE svar (ID int auto_increment, Tekst varchar (100), korrekt boolean, spmID int, primary key(ID), FOREIGN KEY(spmID) REFERENCES spm(ID));
INSERT INTO spm(Tekst) VALUES ('Hva er 7 % 3 i SQL?');
INSERT INTO spm(tekst) values ('Hva er 7/3 ?');
INSERT INTO svar(tekst, korrekt, spmid) VALUES('4', false,1); 
INSERT INTO svar(tekst, korrekt, spmid) VALUES('1', true,1);
INSERT INTO svar(tekst, korrekt, spmid) VALUES('3', false,1);
INSERT INTO svar(tekst, korrekt, spmid) VALUES('2', false,1);
INSERT INTO svar(tekst, korrekt, spmid) VALUES('1,5', false,2);
INSERT INTO svar(tekst, korrekt, spmid) VALUES('2,3', true,2);
INSERT INTO svar(tekst, korrekt, spmid) VALUES('1,7', false,2);

```

---

<div class="post-metadata">

**Author:** ![bbsmooth](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/bbsmooth/32/203556_2.png) [@bbsmooth](https://forum.freecodecamp.org/u/bbsmooth)\
**Post date:** [September 18, 2021, 7:52pm UTC](https://forum.freecodecamp.org/t/join-tables-how-to-join-these-tables-help/478347/2 "2021-09-18T19:52:44Z")

</div>

[SQL - Using Joins](https://www.tutorialspoint.com/sql/sql-using-joins.htm)

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [September 18, 2021, 9:22pm UTC](https://forum.freecodecamp.org/t/join-tables-how-to-join-these-tables-help/478347/3 "2021-09-18T21:22:42Z")

</div>

> **[SQL Join Types – Inner Join VS Outer Join Example](https://www.freecodecamp.org/news/sql-join-types-inner-join-vs-outer-join-example/)**
>
> In a relational database, all information should only be present once. But you might have information that's separated into different tables that's related to each other. And you might want to put this related information together to analyse its...

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [March 20, 2022, 9:22am UTC](https://forum.freecodecamp.org/t/join-tables-how-to-join-these-tables-help/478347/4 "2022-03-20T09:22:43Z")

</div>

Closed on March 20, 2022, 9:22am UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
