- Notifications
You must be signed in to change notification settings - Fork0
Blackode10011/universCelestial
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
byDev-Octavio
1. Create database and connect to it.2. Create tables as required conditions.3. Fill the tables as required data conditions.4. Primary Key and Foreign Key assignment.5. Compact queries into universe.sql file.
Find here the instructions forstart building your projecthttps://www.freecodecamp.org/learn/relational-database/build-a-celestial-bodies-database-project/build-a-celestial-bodies-database
psql --username=freecodecamp --dbname=postgres
After you connected you should create a universe database 😄
CREATE DATABASE universe
and press Enter.
After create the data baseuniverse the next is connect our database pls type
\c universe
Here's some ideas for other column and table names:description
,has_life
,is_spherical
,age_in_millions_of_years
,planet_types
,galaxy_types
,distance_from_earth
.
Notes:If you leave your virtual machine, your database may not be saved. You can make a dump of it by enteringpg_dump -cC --inserts -U freecodecamp universe > universe.sql
in a bash terminal (not the psql one). It will save the commands to rebuild your database inuniverse.sql
. The file will be located where the command was entered. If it's anything inside theproject
folder, the file will be saved in the VM. You can rebuild the database by enteringpsql -U postgres < universe.sql
in a terminal where the.sql
file is.
If you are saving your progress onfreeCodeCamp.org, after getting all the tests to pass, follow the instructions above to save a dump of your database. Save theuniverse.sql
file in a public repository and submit the URL to it onfreeCodeCamp.org.
- You should create a database named
universe
. - Be sure to connect to your database with
\c universe
. Then, you should add tables namedgalaxy
,star
,planet
, andmoon
. - Each table should have a
primary key
. - Each
primary key
should automatically increment. - Each table should have a
name
column. - You should use the
INT
data type for at least two columns that are not a primary or foreign key. - You should use the
NUMERIC
data type at least once. - You should use the
TEXT
data type at least once. - You should use the
BOOLEAN
data type on at least two columns. - Each
star
should have aforeign key
that references one of the rows ingalaxy
. - Each
planet
should have aforeign key
that references one of the rows instar
. - Each
moon
should have aforeign key
that references one of the rows inplanet
. - Your database should have at least five
tables
. - Each table should have at least three rows.
- The
galaxy
andstar
tables should each have at least six rows. - The
planet
table should have at least 12 rows. - The
moon
table should have at least 20 rows. - Each table should have at least three columns.
- The
galaxy
,star
,planet
, andmoon
tables should each have at least five columns. - At least two columns per table should not accept
NULL
values. - At least one column from each table should be required to be
UNIQUE
. - All columns named name should be of type
VARCHAR
. - Each
primary key
column should follow the naming conventiontable_name_id
. For example : themoon
table should have aprimary key
column namedmoon_id
. - Each
foreign key
column should have the same name as thecolumn
it is referencing.
About
Resources
Uh oh!
There was an error while loading.Please reload this page.