Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
NotificationsYou must be signed in to change notification settings

Blackode10011/universCelestial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

byDev-Octavio

follow the instructions below to complete the next challenge :

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

Instructions

For start the postgres you should login on the server using the bellow command

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.

CodeRoad

  1. You should create a database nameduniverse.
  2. Be sure to connect to your database with\c universe. Then, you should add tables namedgalaxy,star,planet, andmoon.
  3. Each table should have aprimary key.
  4. Eachprimary key should automatically increment.
  5. Each table should have aname column.
  6. You should use theINT data type for at least two columns that are not a primary or foreign key.
  7. You should use theNUMERIC data type at least once.
  8. You should use theTEXT data type at least once.
  9. You should use theBOOLEAN data type on at least two columns.
  10. Eachstar should have aforeign key that references one of the rows ingalaxy.
  11. Eachplanet should have aforeign key that references one of the rows instar.
  12. Eachmoon should have aforeign key that references one of the rows inplanet.
  13. Your database should have at least fivetables.
  14. Each table should have at least three rows.
  15. Thegalaxy andstar tables should each have at least six rows.
  16. Theplanet table should have at least 12 rows.
  17. Themoon table should have at least 20 rows.
  18. Each table should have at least three columns.
  19. Thegalaxy,star,planet, andmoon tables should each have at least five columns.
  20. At least two columns per table should not acceptNULL values.
  21. At least one column from each table should be required to beUNIQUE.
  22. All columns named name should be of typeVARCHAR.
  23. Eachprimary key column should follow the naming conventiontable_name_id. For example : themoon table should have aprimary key column namedmoon_id.
  24. Eachforeign key column should have the same name as thecolumn it is referencing.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp