├── .freeCodeCamp ├── .bashrc ├── .psqlrc ├── pg_hba.conf ├── postgresql.conf └── test │ ├── .cwd │ └── .next_command ├── .gitignore ├── .gitpod.yml ├── .vscode └── settings.json ├── CHANGELOG.md ├── TUTORIAL.md ├── coderoad.yaml └── tutorial.json /.freeCodeCamp/.bashrc: -------------------------------------------------------------------------------- 1 | # ~/.bashrc: executed by bash(1) for non-login shells. 2 | # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) 3 | # for examples 4 | 5 | # If not running interactively, don't do anything 6 | case $- in 7 | *i*) ;; 8 | *) return;; 9 | esac 10 | 11 | # don't put duplicate lines or lines starting with space in the history. 12 | # See bash(1) for more options 13 | # I commented this out 14 | #HISTCONTROL=ignoreboth 15 | 16 | # append to the history file, don't overwrite it 17 | shopt -s histappend 18 | 19 | # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) 20 | HISTSIZE=1000 21 | HISTFILESIZE=2000 22 | 23 | # check the window size after each command and, if necessary, 24 | # update the values of LINES and COLUMNS. 25 | shopt -s checkwinsize 26 | 27 | # If set, the pattern "**" used in a pathname expansion context will 28 | # match all files and zero or more directories and subdirectories. 29 | #shopt -s globstar 30 | 31 | # make less more friendly for non-text input files, see lesspipe(1) 32 | # I commented this out 33 | #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" 34 | 35 | # set variable identifying the chroot you work in (used in the prompt below) 36 | if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then 37 | debian_chroot=$(cat /etc/debian_chroot) 38 | fi 39 | 40 | # set a fancy prompt (non-color, unless we know we "want" color) 41 | case "$TERM" in 42 | xterm-color|*-256color) color_prompt=yes;; 43 | esac 44 | 45 | # uncomment for a colored prompt, if the terminal has the capability; turned 46 | # off by default to not distract the user: the focus in a terminal window 47 | # should be on the output of commands, not on the prompt 48 | #force_color_prompt=yes 49 | 50 | if [ -n "$force_color_prompt" ]; then 51 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then 52 | # We have color support; assume it's compliant with Ecma-48 53 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such 54 | # a case would tend to support setf rather than setaf.) 55 | color_prompt=yes 56 | else 57 | color_prompt= 58 | fi 59 | fi 60 | 61 | if [ "$color_prompt" = yes ]; then 62 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' 63 | else 64 | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' 65 | fi 66 | unset color_prompt force_color_prompt 67 | 68 | # If this is an xterm set the title to user@host:dir 69 | case "$TERM" in 70 | xterm*|rxvt*) 71 | PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" 72 | ;; 73 | *) 74 | ;; 75 | esac 76 | 77 | # enable color support of ls and also add handy aliases 78 | if [ -x /usr/bin/dircolors ]; then 79 | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" 80 | alias ls='ls --color=auto' 81 | #alias dir='dir --color=auto' 82 | #alias vdir='vdir --color=auto' 83 | 84 | # I commented these out 85 | # alias grep='grep --color=auto' 86 | # alias fgrep='fgrep --color=auto' 87 | # alias egrep='egrep --color=auto' 88 | fi 89 | 90 | # colored GCC warnings and errors 91 | #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' 92 | 93 | # some more ls aliases - # I commented these out 94 | # alias ll='ls -alF' 95 | # alias la='ls -A' 96 | # alias l='ls -CF' 97 | 98 | # Add an "alert" alias for long running commands. Use like so: 99 | # sleep 10; alert 100 | # I commented this out 101 | #alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' 102 | 103 | # Alias definitions. 104 | # You may want to put all your additions into a separate file like 105 | # ~/.bash_aliases, instead of adding them here directly. 106 | # See /usr/share/doc/bash-doc/examples in the bash-doc package. 107 | 108 | if [ -f ~/.bash_aliases ]; then 109 | . ~/.bash_aliases 110 | fi 111 | 112 | # enable programmable completion features (you don't need to enable 113 | # this, if it's already enabled in /etc/bash.bashrc and /etc/profile 114 | # sources /etc/bash.bashrc). 115 | if ! shopt -oq posix; then 116 | if [ -f /usr/share/bash-completion/bash_completion ]; then 117 | . /usr/share/bash-completion/bash_completion 118 | elif [ -f /etc/bash_completion ]; then 119 | . /etc/bash_completion 120 | fi 121 | fi 122 | 123 | # I commented this out 124 | #for i in $(ls -A $HOME/.bashrc.d/); do source $HOME/.bashrc.d/$i; done 125 | 126 | # Add RVM to PATH for scripting. Make sure this is the last PATH variable change. 127 | export PATH="$PATH:$HOME/.rvm/bin" 128 | 129 | # stuff I added 130 | PS1='camper: \[\033[01;34m\]/${PWD##*/}\[\033[00m\]\$ ' 131 | HISTFILE=/workspace/.bash_history 132 | PROMPT_COMMAND='echo $PWD >> /workspace/project/.freeCodeCamp/test/.cwd; history -a' 133 | trap 'echo $BASH_COMMAND >> /workspace/project/.freeCodeCamp/test/.next_command' DEBUG -------------------------------------------------------------------------------- /.freeCodeCamp/.psqlrc: -------------------------------------------------------------------------------- 1 | \out | tee /workspace/queryResults.log 2 | \pset border 2 3 | \pset title ' ' 4 | \pset pager off -------------------------------------------------------------------------------- /.freeCodeCamp/pg_hba.conf: -------------------------------------------------------------------------------- 1 | # PostgreSQL Client Authentication Configuration File 2 | # =================================================== 3 | # 4 | # Refer to the "Client Authentication" section in the PostgreSQL 5 | # documentation for a complete description of this file. A short 6 | # synopsis follows. 7 | # 8 | # This file controls: which hosts are allowed to connect, how clients 9 | # are authenticated, which PostgreSQL user names they can use, which 10 | # databases they can access. Records take one of these forms: 11 | # 12 | # local DATABASE USER METHOD [OPTIONS] 13 | # host DATABASE USER ADDRESS METHOD [OPTIONS] 14 | # hostssl DATABASE USER ADDRESS METHOD [OPTIONS] 15 | # hostnossl DATABASE USER ADDRESS METHOD [OPTIONS] 16 | # 17 | # (The uppercase items must be replaced by actual values.) 18 | # 19 | # The first field is the connection type: "local" is a Unix-domain 20 | # socket, "host" is either a plain or SSL-encrypted TCP/IP socket, 21 | # "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a 22 | # plain TCP/IP socket. 23 | # 24 | # DATABASE can be "all", "sameuser", "samerole", "replication", a 25 | # database name, or a comma-separated list thereof. The "all" 26 | # keyword does not match "replication". Access to replication 27 | # must be enabled in a separate record (see example below). 28 | # 29 | # USER can be "all", a user name, a group name prefixed with "+", or a 30 | # comma-separated list thereof. In both the DATABASE and USER fields 31 | # you can also write a file name prefixed with "@" to include names 32 | # from a separate file. 33 | # 34 | # ADDRESS specifies the set of hosts the record matches. It can be a 35 | # host name, or it is made up of an IP address and a CIDR mask that is 36 | # an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that 37 | # specifies the number of significant bits in the mask. A host name 38 | # that starts with a dot (.) matches a suffix of the actual host name. 39 | # Alternatively, you can write an IP address and netmask in separate 40 | # columns to specify the set of hosts. Instead of a CIDR-address, you 41 | # can write "samehost" to match any of the server's own IP addresses, 42 | # or "samenet" to match any address in any subnet that the server is 43 | # directly connected to. 44 | # 45 | # METHOD can be "trust", "reject", "md5", "password", "scram-sha-256", 46 | # "gss", "sspi", "ident", "peer", "pam", "ldap", "radius" or "cert". 47 | # Note that "password" sends passwords in clear text; "md5" or 48 | # "scram-sha-256" are preferred since they send encrypted passwords. 49 | # 50 | # OPTIONS are a set of options for the authentication in the format 51 | # NAME=VALUE. The available options depend on the different 52 | # authentication methods -- refer to the "Client Authentication" 53 | # section in the documentation for a list of which options are 54 | # available for which authentication methods. 55 | # 56 | # Database and user names containing spaces, commas, quotes and other 57 | # special characters must be quoted. Quoting one of the keywords 58 | # "all", "sameuser", "samerole" or "replication" makes the name lose 59 | # its special character, and just match a database or username with 60 | # that name. 61 | # 62 | # This file is read on server startup and when the server receives a 63 | # SIGHUP signal. If you edit the file on a running system, you have to 64 | # SIGHUP the server for the changes to take effect, run "pg_ctl reload", 65 | # or execute "SELECT pg_reload_conf()". 66 | # 67 | # Put your actual configuration here 68 | # ---------------------------------- 69 | # 70 | # If you want to allow non-local connections, you need to add more 71 | # "host" records. In that case you will also need to make PostgreSQL 72 | # listen on a non-local interface via the listen_addresses 73 | # configuration parameter, or via the -i or -h command line switches. 74 | 75 | 76 | 77 | 78 | # DO NOT DISABLE! 79 | # If you change this first entry you will need to make sure that the 80 | # database superuser can access the database using some other method. 81 | # Noninteractive access to all databases is required during automatic 82 | # maintenance (custom daily cronjobs, replication, and similar tasks). 83 | # 84 | # Database administrative login by Unix domain socket 85 | local all postgres trust 86 | 87 | # TYPE DATABASE USER ADDRESS METHOD 88 | 89 | # "local" is for Unix domain socket connections only 90 | local all all trust 91 | # IPv4 local connections: 92 | host all all 127.0.0.1/32 trust 93 | # IPv6 local connections: 94 | host all all ::1/128 trust 95 | # Allow replication connections from localhost, by a user with the 96 | # replication privilege. 97 | local replication all trust 98 | host replication all 127.0.0.1/32 trust 99 | host replication all ::1/128 trust -------------------------------------------------------------------------------- /.freeCodeCamp/postgresql.conf: -------------------------------------------------------------------------------- 1 | # ----------------------------- 2 | # PostgreSQL configuration file 3 | # ----------------------------- 4 | # 5 | # This file consists of lines of the form: 6 | # 7 | # name = value 8 | # 9 | # (The "=" is optional.) Whitespace may be used. Comments are introduced with 10 | # "#" anywhere on a line. The complete list of parameter names and allowed 11 | # values can be found in the PostgreSQL documentation. 12 | # 13 | # The commented-out settings shown in this file represent the default values. 14 | # Re-commenting a setting is NOT sufficient to revert it to the default value; 15 | # you need to reload the server. 16 | # 17 | # This file is read on server startup and when the server receives a SIGHUP 18 | # signal. If you edit the file on a running system, you have to SIGHUP the 19 | # server for the changes to take effect, run "pg_ctl reload", or execute 20 | # "SELECT pg_reload_conf()". Some parameters, which are marked below, 21 | # require a server shutdown and restart to take effect. 22 | # 23 | # Any parameter can also be given as a command-line option to the server, e.g., 24 | # "postgres -c log_connections=on". Some parameters can be changed at run time 25 | # with the "SET" SQL command. 26 | # 27 | # Memory units: kB = kilobytes Time units: ms = milliseconds 28 | # MB = megabytes s = seconds 29 | # GB = gigabytes min = minutes 30 | # TB = terabytes h = hours 31 | # d = days 32 | 33 | 34 | #------------------------------------------------------------------------------ 35 | # FILE LOCATIONS 36 | #------------------------------------------------------------------------------ 37 | 38 | # The default values of these variables are driven from the -D command-line 39 | # option or PGDATA environment variable, represented here as ConfigDir. 40 | 41 | data_directory = '/var/lib/postgresql/12/main' # use data in another directory 42 | # (change requires restart) 43 | hba_file = '/etc/postgresql/12/main/pg_hba.conf' # host-based authentication file 44 | # (change requires restart) 45 | ident_file = '/etc/postgresql/12/main/pg_ident.conf' # ident configuration file 46 | # (change requires restart) 47 | 48 | # If external_pid_file is not explicitly set, no extra PID file is written. 49 | external_pid_file = '/var/run/postgresql/12-main.pid' # write an extra PID file 50 | # (change requires restart) 51 | 52 | 53 | #------------------------------------------------------------------------------ 54 | # CONNECTIONS AND AUTHENTICATION 55 | #------------------------------------------------------------------------------ 56 | 57 | # - Connection Settings - 58 | 59 | #listen_addresses = 'localhost' # what IP address(es) to listen on; 60 | # comma-separated list of addresses; 61 | # defaults to 'localhost'; use '*' for all 62 | # (change requires restart) 63 | port = 5432 # (change requires restart) 64 | max_connections = 100 # (change requires restart) 65 | #superuser_reserved_connections = 3 # (change requires restart) 66 | unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories 67 | # (change requires restart) 68 | #unix_socket_group = '' # (change requires restart) 69 | #unix_socket_permissions = 0777 # begin with 0 to use octal notation 70 | # (change requires restart) 71 | #bonjour = off # advertise server via Bonjour 72 | # (change requires restart) 73 | #bonjour_name = '' # defaults to the computer name 74 | # (change requires restart) 75 | 76 | # - TCP settings - 77 | # see "man 7 tcp" for details 78 | 79 | #tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds; 80 | # 0 selects the system default 81 | #tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds; 82 | # 0 selects the system default 83 | #tcp_keepalives_count = 0 # TCP_KEEPCNT; 84 | # 0 selects the system default 85 | #tcp_user_timeout = 0 # TCP_USER_TIMEOUT, in milliseconds; 86 | # 0 selects the system default 87 | 88 | # - Authentication - 89 | 90 | #authentication_timeout = 1min # 1s-600s 91 | #password_encryption = md5 # md5 or scram-sha-256 92 | #db_user_namespace = off 93 | 94 | # GSSAPI using Kerberos 95 | #krb_server_keyfile = '' 96 | #krb_caseins_users = off 97 | 98 | # - SSL - 99 | 100 | ssl = on 101 | #ssl_ca_file = '' 102 | ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' 103 | #ssl_crl_file = '' 104 | ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' 105 | #ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' # allowed SSL ciphers 106 | #ssl_prefer_server_ciphers = on 107 | #ssl_ecdh_curve = 'prime256v1' 108 | #ssl_min_protocol_version = 'TLSv1' 109 | #ssl_max_protocol_version = '' 110 | #ssl_dh_params_file = '' 111 | #ssl_passphrase_command = '' 112 | #ssl_passphrase_command_supports_reload = off 113 | 114 | 115 | #------------------------------------------------------------------------------ 116 | # RESOURCE USAGE (except WAL) 117 | #------------------------------------------------------------------------------ 118 | 119 | # - Memory - 120 | 121 | shared_buffers = 128MB # min 128kB 122 | # (change requires restart) 123 | #huge_pages = try # on, off, or try 124 | # (change requires restart) 125 | #temp_buffers = 8MB # min 800kB 126 | #max_prepared_transactions = 0 # zero disables the feature 127 | # (change requires restart) 128 | # Caution: it is not advisable to set max_prepared_transactions nonzero unless 129 | # you actively intend to use prepared transactions. 130 | #work_mem = 4MB # min 64kB 131 | #maintenance_work_mem = 64MB # min 1MB 132 | #autovacuum_work_mem = -1 # min 1MB, or -1 to use maintenance_work_mem 133 | #max_stack_depth = 2MB # min 100kB 134 | #shared_memory_type = mmap # the default is the first option 135 | # supported by the operating system: 136 | # mmap 137 | # sysv 138 | # windows 139 | # (change requires restart) 140 | dynamic_shared_memory_type = posix # the default is the first option 141 | # supported by the operating system: 142 | # posix 143 | # sysv 144 | # windows 145 | # mmap 146 | # (change requires restart) 147 | 148 | # - Disk - 149 | 150 | #temp_file_limit = -1 # limits per-process temp file space 151 | # in kB, or -1 for no limit 152 | 153 | # - Kernel Resources - 154 | 155 | #max_files_per_process = 1000 # min 25 156 | # (change requires restart) 157 | 158 | # - Cost-Based Vacuum Delay - 159 | 160 | #vacuum_cost_delay = 0 # 0-100 milliseconds (0 disables) 161 | #vacuum_cost_page_hit = 1 # 0-10000 credits 162 | #vacuum_cost_page_miss = 10 # 0-10000 credits 163 | #vacuum_cost_page_dirty = 20 # 0-10000 credits 164 | #vacuum_cost_limit = 200 # 1-10000 credits 165 | 166 | # - Background Writer - 167 | 168 | #bgwriter_delay = 200ms # 10-10000ms between rounds 169 | #bgwriter_lru_maxpages = 100 # max buffers written/round, 0 disables 170 | #bgwriter_lru_multiplier = 2.0 # 0-10.0 multiplier on buffers scanned/round 171 | #bgwriter_flush_after = 512kB # measured in pages, 0 disables 172 | 173 | # - Asynchronous Behavior - 174 | 175 | #effective_io_concurrency = 1 # 1-1000; 0 disables prefetching 176 | #max_worker_processes = 8 # (change requires restart) 177 | #max_parallel_maintenance_workers = 2 # taken from max_parallel_workers 178 | #max_parallel_workers_per_gather = 2 # taken from max_parallel_workers 179 | #parallel_leader_participation = on 180 | #max_parallel_workers = 8 # maximum number of max_worker_processes that 181 | # can be used in parallel operations 182 | #old_snapshot_threshold = -1 # 1min-60d; -1 disables; 0 is immediate 183 | # (change requires restart) 184 | #backend_flush_after = 0 # measured in pages, 0 disables 185 | 186 | 187 | #------------------------------------------------------------------------------ 188 | # WRITE-AHEAD LOG 189 | #------------------------------------------------------------------------------ 190 | 191 | # - Settings - 192 | 193 | #wal_level = replica # minimal, replica, or logical 194 | # (change requires restart) 195 | #fsync = on # flush data to disk for crash safety 196 | # (turning this off can cause 197 | # unrecoverable data corruption) 198 | #synchronous_commit = on # synchronization level; 199 | # off, local, remote_write, remote_apply, or on 200 | #wal_sync_method = fsync # the default is the first option 201 | # supported by the operating system: 202 | # open_datasync 203 | # fdatasync (default on Linux) 204 | # fsync 205 | # fsync_writethrough 206 | # open_sync 207 | #full_page_writes = on # recover from partial page writes 208 | #wal_compression = off # enable compression of full-page writes 209 | #wal_log_hints = off # also do full page writes of non-critical updates 210 | # (change requires restart) 211 | #wal_init_zero = on # zero-fill new WAL files 212 | #wal_recycle = on # recycle WAL files 213 | #wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers 214 | # (change requires restart) 215 | #wal_writer_delay = 200ms # 1-10000 milliseconds 216 | #wal_writer_flush_after = 1MB # measured in pages, 0 disables 217 | 218 | #commit_delay = 0 # range 0-100000, in microseconds 219 | #commit_siblings = 5 # range 1-1000 220 | 221 | # - Checkpoints - 222 | 223 | #checkpoint_timeout = 5min # range 30s-1d 224 | max_wal_size = 1GB 225 | min_wal_size = 80MB 226 | #checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0 227 | #checkpoint_flush_after = 256kB # measured in pages, 0 disables 228 | #checkpoint_warning = 30s # 0 disables 229 | 230 | # - Archiving - 231 | 232 | #archive_mode = off # enables archiving; off, on, or always 233 | # (change requires restart) 234 | #archive_command = '' # command to use to archive a logfile segment 235 | # placeholders: %p = path of file to archive 236 | # %f = file name only 237 | # e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f' 238 | #archive_timeout = 0 # force a logfile segment switch after this 239 | # number of seconds; 0 disables 240 | 241 | # - Archive Recovery - 242 | 243 | # These are only used in recovery mode. 244 | 245 | #restore_command = '' # command to use to restore an archived logfile segment 246 | # placeholders: %p = path of file to restore 247 | # %f = file name only 248 | # e.g. 'cp /mnt/server/archivedir/%f %p' 249 | # (change requires restart) 250 | #archive_cleanup_command = '' # command to execute at every restartpoint 251 | #recovery_end_command = '' # command to execute at completion of recovery 252 | 253 | # - Recovery Target - 254 | 255 | # Set these only when performing a targeted recovery. 256 | 257 | #recovery_target = '' # 'immediate' to end recovery as soon as a 258 | # consistent state is reached 259 | # (change requires restart) 260 | #recovery_target_name = '' # the named restore point to which recovery will proceed 261 | # (change requires restart) 262 | #recovery_target_time = '' # the time stamp up to which recovery will proceed 263 | # (change requires restart) 264 | #recovery_target_xid = '' # the transaction ID up to which recovery will proceed 265 | # (change requires restart) 266 | #recovery_target_lsn = '' # the WAL LSN up to which recovery will proceed 267 | # (change requires restart) 268 | #recovery_target_inclusive = on # Specifies whether to stop: 269 | # just after the specified recovery target (on) 270 | # just before the recovery target (off) 271 | # (change requires restart) 272 | #recovery_target_timeline = 'latest' # 'current', 'latest', or timeline ID 273 | # (change requires restart) 274 | #recovery_target_action = 'pause' # 'pause', 'promote', 'shutdown' 275 | # (change requires restart) 276 | 277 | 278 | #------------------------------------------------------------------------------ 279 | # REPLICATION 280 | #------------------------------------------------------------------------------ 281 | 282 | # - Sending Servers - 283 | 284 | # Set these on the master and on any standby that will send replication data. 285 | 286 | #max_wal_senders = 10 # max number of walsender processes 287 | # (change requires restart) 288 | #wal_keep_segments = 0 # in logfile segments; 0 disables 289 | #wal_sender_timeout = 60s # in milliseconds; 0 disables 290 | 291 | #max_replication_slots = 10 # max number of replication slots 292 | # (change requires restart) 293 | #track_commit_timestamp = off # collect timestamp of transaction commit 294 | # (change requires restart) 295 | 296 | # - Master Server - 297 | 298 | # These settings are ignored on a standby server. 299 | 300 | #synchronous_standby_names = '' # standby servers that provide sync rep 301 | # method to choose sync standbys, number of sync standbys, 302 | # and comma-separated list of application_name 303 | # from standby(s); '*' = all 304 | #vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed 305 | 306 | # - Standby Servers - 307 | 308 | # These settings are ignored on a master server. 309 | 310 | #primary_conninfo = '' # connection string to sending server 311 | # (change requires restart) 312 | #primary_slot_name = '' # replication slot on sending server 313 | # (change requires restart) 314 | #promote_trigger_file = '' # file name whose presence ends recovery 315 | #hot_standby = on # "off" disallows queries during recovery 316 | # (change requires restart) 317 | #max_standby_archive_delay = 30s # max delay before canceling queries 318 | # when reading WAL from archive; 319 | # -1 allows indefinite delay 320 | #max_standby_streaming_delay = 30s # max delay before canceling queries 321 | # when reading streaming WAL; 322 | # -1 allows indefinite delay 323 | #wal_receiver_status_interval = 10s # send replies at least this often 324 | # 0 disables 325 | #hot_standby_feedback = off # send info from standby to prevent 326 | # query conflicts 327 | #wal_receiver_timeout = 60s # time that receiver waits for 328 | # communication from master 329 | # in milliseconds; 0 disables 330 | #wal_retrieve_retry_interval = 5s # time to wait before retrying to 331 | # retrieve WAL after a failed attempt 332 | #recovery_min_apply_delay = 0 # minimum delay for applying changes during recovery 333 | 334 | # - Subscribers - 335 | 336 | # These settings are ignored on a publisher. 337 | 338 | #max_logical_replication_workers = 4 # taken from max_worker_processes 339 | # (change requires restart) 340 | #max_sync_workers_per_subscription = 2 # taken from max_logical_replication_workers 341 | 342 | 343 | #------------------------------------------------------------------------------ 344 | # QUERY TUNING 345 | #------------------------------------------------------------------------------ 346 | 347 | # - Planner Method Configuration - 348 | 349 | #enable_bitmapscan = on 350 | #enable_hashagg = on 351 | #enable_hashjoin = on 352 | #enable_indexscan = on 353 | #enable_indexonlyscan = on 354 | #enable_material = on 355 | #enable_mergejoin = on 356 | #enable_nestloop = on 357 | #enable_parallel_append = on 358 | #enable_seqscan = on 359 | #enable_sort = on 360 | #enable_tidscan = on 361 | #enable_partitionwise_join = off 362 | #enable_partitionwise_aggregate = off 363 | #enable_parallel_hash = on 364 | #enable_partition_pruning = on 365 | 366 | # - Planner Cost Constants - 367 | 368 | #seq_page_cost = 1.0 # measured on an arbitrary scale 369 | #random_page_cost = 4.0 # same scale as above 370 | #cpu_tuple_cost = 0.01 # same scale as above 371 | #cpu_index_tuple_cost = 0.005 # same scale as above 372 | #cpu_operator_cost = 0.0025 # same scale as above 373 | #parallel_tuple_cost = 0.1 # same scale as above 374 | #parallel_setup_cost = 1000.0 # same scale as above 375 | 376 | #jit_above_cost = 100000 # perform JIT compilation if available 377 | # and query more expensive than this; 378 | # -1 disables 379 | #jit_inline_above_cost = 500000 # inline small functions if query is 380 | # more expensive than this; -1 disables 381 | #jit_optimize_above_cost = 500000 # use expensive JIT optimizations if 382 | # query is more expensive than this; 383 | # -1 disables 384 | 385 | #min_parallel_table_scan_size = 8MB 386 | #min_parallel_index_scan_size = 512kB 387 | #effective_cache_size = 4GB 388 | 389 | # - Genetic Query Optimizer - 390 | 391 | #geqo = on 392 | #geqo_threshold = 12 393 | #geqo_effort = 5 # range 1-10 394 | #geqo_pool_size = 0 # selects default based on effort 395 | #geqo_generations = 0 # selects default based on effort 396 | #geqo_selection_bias = 2.0 # range 1.5-2.0 397 | #geqo_seed = 0.0 # range 0.0-1.0 398 | 399 | # - Other Planner Options - 400 | 401 | #default_statistics_target = 100 # range 1-10000 402 | #constraint_exclusion = partition # on, off, or partition 403 | #cursor_tuple_fraction = 0.1 # range 0.0-1.0 404 | #from_collapse_limit = 8 405 | #join_collapse_limit = 8 # 1 disables collapsing of explicit 406 | # JOIN clauses 407 | #force_parallel_mode = off 408 | #jit = on # allow JIT compilation 409 | #plan_cache_mode = auto # auto, force_generic_plan or 410 | # force_custom_plan 411 | 412 | 413 | #------------------------------------------------------------------------------ 414 | # REPORTING AND LOGGING 415 | #------------------------------------------------------------------------------ 416 | 417 | # - Where to Log - 418 | 419 | #log_destination = 'stderr' # Valid values are combinations of 420 | # stderr, csvlog, syslog, and eventlog, 421 | # depending on platform. csvlog 422 | # requires logging_collector to be on. 423 | 424 | # This is used when logging to stderr: 425 | #logging_collector = off # Enable capturing of stderr and csvlog 426 | # into log files. Required to be on for 427 | # csvlogs. 428 | # (change requires restart) 429 | 430 | # These are only used if logging_collector is on: 431 | #log_directory = 'log' # directory where log files are written, 432 | # can be absolute or relative to PGDATA 433 | #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern, 434 | # can include strftime() escapes 435 | #log_file_mode = 0600 # creation mode for log files, 436 | # begin with 0 to use octal notation 437 | #log_truncate_on_rotation = off # If on, an existing log file with the 438 | # same name as the new log file will be 439 | # truncated rather than appended to. 440 | # But such truncation only occurs on 441 | # time-driven rotation, not on restarts 442 | # or size-driven rotation. Default is 443 | # off, meaning append to existing files 444 | # in all cases. 445 | #log_rotation_age = 1d # Automatic rotation of logfiles will 446 | # happen after that time. 0 disables. 447 | #log_rotation_size = 10MB # Automatic rotation of logfiles will 448 | # happen after that much log output. 449 | # 0 disables. 450 | 451 | # These are relevant when logging to syslog: 452 | #syslog_facility = 'LOCAL0' 453 | #syslog_ident = 'postgres' 454 | #syslog_sequence_numbers = on 455 | #syslog_split_messages = on 456 | 457 | # This is only relevant when logging to eventlog (win32): 458 | # (change requires restart) 459 | #event_source = 'PostgreSQL' 460 | 461 | # - When to Log - 462 | 463 | #log_min_messages = warning # values in order of decreasing detail: 464 | # debug5 465 | # debug4 466 | # debug3 467 | # debug2 468 | # debug1 469 | # info 470 | # notice 471 | # warning 472 | # error 473 | # log 474 | # fatal 475 | # panic 476 | 477 | #log_min_error_statement = error # values in order of decreasing detail: 478 | # debug5 479 | # debug4 480 | # debug3 481 | # debug2 482 | # debug1 483 | # info 484 | # notice 485 | # warning 486 | # error 487 | # log 488 | # fatal 489 | # panic (effectively off) 490 | 491 | #log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements 492 | # and their durations, > 0 logs only 493 | # statements running at least this number 494 | # of milliseconds 495 | 496 | #log_transaction_sample_rate = 0.0 # Fraction of transactions whose statements 497 | # are logged regardless of their duration. 1.0 logs all 498 | # statements from all transactions, 0.0 never logs. 499 | 500 | # - What to Log - 501 | 502 | #debug_print_parse = off 503 | #debug_print_rewritten = off 504 | #debug_print_plan = off 505 | #debug_pretty_print = on 506 | #log_checkpoints = off 507 | #log_connections = off 508 | #log_disconnections = off 509 | #log_duration = off 510 | #log_error_verbosity = default # terse, default, or verbose messages 511 | #log_hostname = off 512 | #log_line_prefix = '%m [%p] %q%u@%d ' # special values: 513 | # %a = application name 514 | # %u = user name 515 | # %d = database name 516 | # %r = remote host and port 517 | # %h = remote host 518 | # %p = process ID 519 | # %t = timestamp without milliseconds 520 | # %m = timestamp with milliseconds 521 | # %n = timestamp with milliseconds (as a Unix epoch) 522 | # %i = command tag 523 | # %e = SQL state 524 | # %c = session ID 525 | # %l = session line number 526 | # %s = session start timestamp 527 | # %v = virtual transaction ID 528 | # %x = transaction ID (0 if none) 529 | # %q = stop here in non-session 530 | # processes 531 | # %% = '%' 532 | # e.g. '<%u%%%d> ' 533 | #log_lock_waits = off # log lock waits >= deadlock_timeout 534 | #log_statement = 'none' # none, ddl, mod, all 535 | #log_replication_commands = off 536 | #log_temp_files = -1 # log temporary files equal or larger 537 | # than the specified size in kilobytes; 538 | # -1 disables, 0 logs all temp files 539 | log_timezone = 'Europe/Warsaw' 540 | 541 | #------------------------------------------------------------------------------ 542 | # PROCESS TITLE 543 | #------------------------------------------------------------------------------ 544 | 545 | cluster_name = '12/main' # added to process titles if nonempty 546 | # (change requires restart) 547 | #update_process_title = on 548 | 549 | 550 | #------------------------------------------------------------------------------ 551 | # STATISTICS 552 | #------------------------------------------------------------------------------ 553 | 554 | # - Query and Index Statistics Collector - 555 | 556 | #track_activities = on 557 | #track_counts = on 558 | #track_io_timing = off 559 | #track_functions = none # none, pl, all 560 | #track_activity_query_size = 1024 # (change requires restart) 561 | stats_temp_directory = '/var/run/postgresql/12-main.pg_stat_tmp' 562 | 563 | 564 | # - Monitoring - 565 | 566 | #log_parser_stats = off 567 | #log_planner_stats = off 568 | #log_executor_stats = off 569 | #log_statement_stats = off 570 | 571 | 572 | #------------------------------------------------------------------------------ 573 | # AUTOVACUUM 574 | #------------------------------------------------------------------------------ 575 | 576 | #autovacuum = on # Enable autovacuum subprocess? 'on' 577 | # requires track_counts to also be on. 578 | #log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and 579 | # their durations, > 0 logs only 580 | # actions running at least this number 581 | # of milliseconds. 582 | #autovacuum_max_workers = 3 # max number of autovacuum subprocesses 583 | # (change requires restart) 584 | #autovacuum_naptime = 1min # time between autovacuum runs 585 | #autovacuum_vacuum_threshold = 50 # min number of row updates before 586 | # vacuum 587 | #autovacuum_analyze_threshold = 50 # min number of row updates before 588 | # analyze 589 | #autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum 590 | #autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze 591 | #autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum 592 | # (change requires restart) 593 | #autovacuum_multixact_freeze_max_age = 400000000 # maximum multixact age 594 | # before forced vacuum 595 | # (change requires restart) 596 | #autovacuum_vacuum_cost_delay = 2ms # default vacuum cost delay for 597 | # autovacuum, in milliseconds; 598 | # -1 means use vacuum_cost_delay 599 | #autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for 600 | # autovacuum, -1 means use 601 | # vacuum_cost_limit 602 | 603 | 604 | #------------------------------------------------------------------------------ 605 | # CLIENT CONNECTION DEFAULTS 606 | #------------------------------------------------------------------------------ 607 | 608 | # - Statement Behavior - 609 | 610 | #client_min_messages = notice # values in order of decreasing detail: 611 | # debug5 612 | # debug4 613 | # debug3 614 | # debug2 615 | # debug1 616 | # log 617 | # notice 618 | # warning 619 | # error 620 | #search_path = '"$user", public' # schema names 621 | #row_security = on 622 | #default_tablespace = '' # a tablespace name, '' uses the default 623 | #temp_tablespaces = '' # a list of tablespace names, '' uses 624 | # only default tablespace 625 | #default_table_access_method = 'heap' 626 | #check_function_bodies = on 627 | #default_transaction_isolation = 'read committed' 628 | #default_transaction_read_only = off 629 | #default_transaction_deferrable = off 630 | #session_replication_role = 'origin' 631 | #statement_timeout = 0 # in milliseconds, 0 is disabled 632 | #lock_timeout = 0 # in milliseconds, 0 is disabled 633 | #idle_in_transaction_session_timeout = 0 # in milliseconds, 0 is disabled 634 | #vacuum_freeze_min_age = 50000000 635 | #vacuum_freeze_table_age = 150000000 636 | #vacuum_multixact_freeze_min_age = 5000000 637 | #vacuum_multixact_freeze_table_age = 150000000 638 | #vacuum_cleanup_index_scale_factor = 0.1 # fraction of total number of tuples 639 | # before index cleanup, 0 always performs 640 | # index cleanup 641 | #bytea_output = 'hex' # hex, escape 642 | #xmlbinary = 'base64' 643 | #xmloption = 'content' 644 | #gin_fuzzy_search_limit = 0 645 | #gin_pending_list_limit = 4MB 646 | 647 | # - Locale and Formatting - 648 | 649 | datestyle = 'iso, mdy' 650 | #intervalstyle = 'postgres' 651 | timezone = 'Europe/Warsaw' 652 | #timezone_abbreviations = 'Default' # Select the set of available time zone 653 | # abbreviations. Currently, there are 654 | # Default 655 | # Australia (historical usage) 656 | # India 657 | # You can create your own file in 658 | # share/timezonesets/. 659 | #extra_float_digits = 1 # min -15, max 3; any value >0 actually 660 | # selects precise output mode 661 | #client_encoding = sql_ascii # actually, defaults to database 662 | # encoding 663 | 664 | # These settings are initialized by initdb, but they can be changed. 665 | lc_messages = 'C.UTF-8' # locale for system error message 666 | # strings 667 | lc_monetary = 'C.UTF-8' # locale for monetary formatting 668 | lc_numeric = 'C.UTF-8' # locale for number formatting 669 | lc_time = 'C.UTF-8' # locale for time formatting 670 | 671 | # default configuration for text search 672 | default_text_search_config = 'pg_catalog.english' 673 | 674 | # - Shared Library Preloading - 675 | 676 | #shared_preload_libraries = '' # (change requires restart) 677 | #local_preload_libraries = '' 678 | #session_preload_libraries = '' 679 | #jit_provider = 'llvmjit' # JIT library to use 680 | 681 | # - Other Defaults - 682 | 683 | #dynamic_library_path = '$libdir' 684 | 685 | 686 | #------------------------------------------------------------------------------ 687 | # LOCK MANAGEMENT 688 | #------------------------------------------------------------------------------ 689 | 690 | #deadlock_timeout = 1s 691 | #max_locks_per_transaction = 64 # min 10 692 | # (change requires restart) 693 | #max_pred_locks_per_transaction = 64 # min 10 694 | # (change requires restart) 695 | #max_pred_locks_per_relation = -2 # negative values mean 696 | # (max_pred_locks_per_transaction 697 | # / -max_pred_locks_per_relation) - 1 698 | #max_pred_locks_per_page = 2 # min 0 699 | 700 | 701 | #------------------------------------------------------------------------------ 702 | # VERSION AND PLATFORM COMPATIBILITY 703 | #------------------------------------------------------------------------------ 704 | 705 | # - Previous PostgreSQL Versions - 706 | 707 | #array_nulls = on 708 | #backslash_quote = safe_encoding # on, off, or safe_encoding 709 | #escape_string_warning = on 710 | #lo_compat_privileges = off 711 | #operator_precedence_warning = off 712 | #quote_all_identifiers = off 713 | #standard_conforming_strings = on 714 | #synchronize_seqscans = on 715 | 716 | # - Other Platforms and Clients - 717 | 718 | #transform_null_equals = off 719 | 720 | 721 | #------------------------------------------------------------------------------ 722 | # ERROR HANDLING 723 | #------------------------------------------------------------------------------ 724 | 725 | #exit_on_error = off # terminate session on any error? 726 | #restart_after_crash = on # reinitialize after backend crash? 727 | #data_sync_retry = off # retry or panic on failure to fsync 728 | # data? 729 | # (change requires restart) 730 | 731 | 732 | #------------------------------------------------------------------------------ 733 | # CONFIG FILE INCLUDES 734 | #------------------------------------------------------------------------------ 735 | 736 | # These options allow settings to be loaded from files other than the 737 | # default postgresql.conf. Note that these are directives, not variable 738 | # assignments, so they can usefully be given more than once. 739 | 740 | include_dir = 'conf.d' # include files ending in '.conf' from 741 | # a directory, e.g., 'conf.d' 742 | #include_if_exists = '...' # include file only if it exists 743 | #include = '...' # include file 744 | 745 | 746 | #------------------------------------------------------------------------------ 747 | # CUSTOMIZED OPTIONS 748 | #------------------------------------------------------------------------------ 749 | 750 | # Add settings for extensions here 751 | 752 | # Settings I changed from the defaults above 753 | log_statement = 'all' 754 | log_min_error_statement = INFO 755 | log_min_messages = INFO 756 | logging_collector = on 757 | log_directory = '/workspace/' 758 | log_filename = 'pg.log' 759 | log_connections = on 760 | log_line_prefix = '%u ' -------------------------------------------------------------------------------- /.freeCodeCamp/test/.cwd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gaerwn/learn-relational-databases-by-building-a-mario-database/c59c1410edf825c7e8a42c39d37f10700022fbf3/.freeCodeCamp/test/.cwd -------------------------------------------------------------------------------- /.freeCodeCamp/test/.next_command: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gaerwn/learn-relational-databases-by-building-a-mario-database/c59c1410edf825c7e8a42c39d37f10700022fbf3/.freeCodeCamp/test/.next_command -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | image: gitpod/workspace-postgres:2024-01-24-09-19-42 2 | 3 | workspaceLocation: 'project' 4 | checkoutLocation: 'project' 5 | 6 | tasks: 7 | - before: | 8 | sudo cp /workspace/project/.freeCodeCamp/.bashrc ~/.bashrc 9 | sudo cp /workspace/project/.freeCodeCamp/.psqlrc ~/.psqlrc 10 | sudo cp /workspace/project/.freeCodeCamp/postgresql.conf /etc/postgresql/12/main/postgresql.conf 11 | sudo cp /workspace/project/.freeCodeCamp/pg_hba.conf /etc/postgresql/12/main/pg_hba.conf 12 | sudo touch /workspace/.bash_history 13 | sudo touch /workspace/pg.log 14 | sudo touch /workspace/queryResults.log 15 | sudo chmod -R 777 /workspace 16 | sudo chown -R postgres:postgres /var/lib/postgresql/12/main 17 | 18 | command: | 19 | sudo rm /workspace/project/CHANGELOG.md 20 | sudo rm /workspace/project/coderoad.yaml 21 | sudo rm /workspace/project/tutorial.json 22 | sudo rm /workspace/project/TUTORIAL.md 23 | pg_stop && sudo service postgresql start && echo "SELECT 'CREATE USER freecodecamp WITH CREATEDB' WHERE NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname='freecodecamp')\gexec" | psql -U postgres -X 24 | exit 25 | 26 | vscode: 27 | extensions: 28 | - CodeRoad.coderoad 29 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "breadcrumbs.enabled": false, 3 | "debug.internalConsoleOptions": "neverOpen", 4 | "debug.showInStatusBar": "never", 5 | "editor.acceptSuggestionOnCommitCharacter": false, 6 | "editor.acceptSuggestionOnEnter": "off", 7 | "editor.autoClosingBrackets": "never", 8 | "editor.codeActionsOnSave": { 9 | "source.fixAll": "explicit" 10 | }, 11 | "editor.hover.enabled": false, 12 | "editor.inlineSuggest.enabled": false, 13 | "editor.minimap.enabled": false, 14 | "editor.parameterHints.enabled": false, 15 | "editor.quickSuggestions": { 16 | "other": false, 17 | "comments": false, 18 | "strings": false 19 | }, 20 | "editor.referenceInfos": false, 21 | "editor.snippetSuggestions": "none", 22 | "editor.suggest.statusBar.visible": false, 23 | "editor.suggestOnTriggerCharacters": false, 24 | "editor.tabSize": 2, 25 | "explorer.autoReveal": false, 26 | "explorer.openEditors.visible": 0, 27 | "extensions.autoCheckUpdates": false, 28 | "extensions.ignoreRecommendations": true, 29 | "files.autoSave": "afterDelay", 30 | "files.exclude": { 31 | "**/.git": true, 32 | "**/.svn": true, 33 | "**/.hg": true, 34 | "**/CVS": true, 35 | "**/.DS_Store": true, 36 | ".vscode": true, 37 | ".gitignore": true, 38 | ".freeCodeCamp": true, 39 | "learn-relational-databases-by-building-a-mario-database": true, 40 | ".gitpod.Dockerfile": true, 41 | ".gitpod.yml": true, 42 | "CHANGELOG.md": true, 43 | "coderoad.yaml": true, 44 | "tutorial.json": true, 45 | "TUTORIAL.md": true 46 | }, 47 | "html.autoClosingTags": false, 48 | "npm.fetchOnlinePackageInfo": false, 49 | "task.slowProviderWarning": false, 50 | "terminal.integrated.allowChords": false, 51 | "terminal.integrated.commandsToSkipShell": ["coderoad.enter"], 52 | "terminal.integrated.enableFileLinks": false, 53 | "terminal.integrated.environmentChangesIndicator": "off", 54 | "terminal.integrated.macOptionIsMeta": true, 55 | "terminal.integrated.showExitAlert": false, 56 | "telemetry.enableTelemetry": false, 57 | "update.mode": "none", 58 | "update.showReleaseNotes": false, 59 | "workbench.enableExperiments": false, 60 | "workbench.startupEditor": "none", 61 | "workbench.colorTheme": "Tomorrow Night Blue", 62 | "workbench.colorCustomizations": { 63 | "[Tomorrow Night Blue]": { 64 | "menu.background": "#0a0a23", 65 | "menu.foreground": "#ffffff", 66 | "activityBar.background": "#0a0a23", 67 | "activityBar.foreground": "#ffffff", 68 | "activityBar.activeBorder": "#ffffff", 69 | "activityBar.border": "#2a2a40", 70 | "editorWidget.background": "#0a0a23", 71 | "editorWidget.foreground": "#ffffff", 72 | "sideBar.background": "#1b1b32", 73 | "sideBarTitle.foreground": "#858591", 74 | "sideBar.foreground": "#f5f6f7", 75 | "sideBar.border": "#2a2a40", 76 | "editor.background": "#2a2a40", 77 | "editor.foreground": "#dfdfe2", 78 | "tab.activeForeground": "#ffffff", 79 | "tab.inactiveBackground": "#1b1b32", 80 | "tab.inactiveForeground": "#d0d0d5", 81 | "tab.border": "#2a2a40", 82 | "editorGroupHeader.tabsBackground": "#0a0a23", 83 | "editorIndentGuide.background": "#3b3b4f", 84 | "terminal.background": "#0a0a23", 85 | "terminal.foreground": "#ffffff", 86 | "terminal.ansiBrightGreen": "#ffffff", 87 | "panel.background": "#1b1b32", 88 | "panelTitle.inactiveForeground": "#858591", 89 | "panelTitle.activeBorder": "#f5f6f7" 90 | } 91 | }, 92 | "workbench.iconTheme": null, 93 | "workbench.statusBar.visible": false, 94 | "workbench.tips.enabled": false, 95 | "workbench.tree.renderIndentGuides": "none", 96 | "zenMode.centerLayout": false 97 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Contributing 2 | 3 | Please read the guidelines in the [contributing docs](https://contribute.freecodecamp.org/#/how-to-work-on-tutorials-that-use-coderoad) before contributing. Contributions to this project need to follow the correct workflow. 4 | 5 | # Change Log 6 | 7 | Whenever a new version is created, add the new branch name and the changes here 8 | 9 | ## [v1.0.0] 10 | 11 | - Initial soft release with news article 12 | 13 | ## [v1.0.1] 14 | 15 | - Fix issues with logs not being generated after reset 16 | - Move the two SQL log files to ~ 17 | - Change to that location in postgresql.conf 18 | - Update all watchers to that location 19 | - Change tests to get logs from those locations 20 | 21 | ## [v1.0.2] 22 | 23 | - Fix typo in `yippee.wav` 24 | - Change `TUTORIAL.md` 25 | - Change test `.freeCodeCamp/test/1320.test.js` in step `1320.1` 26 | - Change `.freeCodeCamp/db.sql` in step `1330.1` 27 | 28 | ## [v1.0.3] 29 | 30 | - Move startup commands to `reset.sh` 31 | - Run `reset.sh` on continue 32 | - Add `IF EXISTS` to `db.sql` when dropping database to stop warnings 33 | - Terminate only user `freeCodeCamp` from db when resetting 34 | 35 | ## [v1.0.4] 36 | 37 | - This is an attempt to fix the frequent [issues that have come up on the forum](https://forum.freecodecamp.org/t/bug-in-building-a-mario-database/493206) 38 | - Instead of loading a new test file, and commenting out the old one on each commit, this loads all the tests in the `INIT` commit and uses mocha settings to only run tests in a specific file. The commits now just change the test file that should run. 39 | - There was an issue with the last commit not loading after using the reset button in a tutorial. I added a final commit at end that seems to have resolved it. 40 | - Fix test text on 1660, 1670, and 1680 41 | - Fix bad hints on 1260 - [Issue](https://github.com/freeCodeCamp/freeCodeCamp/issues/45532) 42 | 43 | ## [v1.0.5] 44 | 45 | - Fix test 890 to check for `more_info` table name 46 | - Fix test 895 - see issue: https://github.com/freeCodeCamp/freeCodeCamp/issues/48521 47 | 48 | ## [v2.0.0] 49 | 50 | - Add Gitpod config 51 | -------------------------------------------------------------------------------- /TUTORIAL.md: -------------------------------------------------------------------------------- 1 | # Learn Relational Databases by Building a Mario Database 2 | 3 | > Welcome to the Relational Database Lessons! 4 | 5 | ## 10. Start the Terminal 6 | 7 | ### 10.1 8 | 9 | **The first thing you need to do is start the terminal.** Do that by clicking the "hamburger" menu at the top left of the screen, going to the "terminal" section, and clicking "new terminal". Once you open a new one, type `echo hello PostgreSQL` into the terminal and press enter. 10 | 11 | #### HINTS 12 | 13 | - Capitalization matters 14 | - If the tests don't run automatically, try typing `exit` into the terminal and redoing the instructions 15 | 16 | ## 20. Login 17 | 18 | ### 20.1 19 | 20 | Your virtual machine comes with PostgreSQL installed. You will use the Psql terminal application to interact with it. Log in by typing `psql --username=freecodecamp --dbname=postgres` into the terminal and pressing enter. 21 | 22 | #### HINTS 23 | 24 | - Capitalization matters 25 | - Type `psql --username=freecodecamp --dbname=postgres` into the terminal and press enter 26 | - If the terminal isn't open, find the "hamburger" menu at the top left of the window, navigate to the "Terminal" tab, and click "New Terminal" 27 | 28 | ## 30. View Databases 29 | 30 | ### 30.1 31 | 32 | Notice that the prompt changed to let you know that you are now interacting with PostgreSQL. First thing to do is see what databases are here. Type `\l` into the prompt to **l**ist them. 33 | 34 | #### HINTS 35 | 36 | - Type `\l` into the psql prompt and press enter 37 | - Type `psql --username=freecodecamp --dbname=postgres` into the terminal to log in to psql if you aren't logged in first 38 | 39 | ## 40. Create `first_database` 40 | 41 | ### 40.1 42 | 43 | The databases you see are there by default. You can make your own like this: 44 | 45 | ```sql 46 | CREATE DATABASE database_name; 47 | ``` 48 | 49 | The capitalized words are keywords telling PostgreSQL what to do. The name of the database is the lowercase word. Note that **all commands need a semi-colon at the end.** Create a new database named `first_database`. 50 | 51 | #### HINTS 52 | 53 | - Don't forget the semi-colon at the end 54 | - Type `CREATE DATABASE first_database;` into the psql prompt and press enter 55 | - Type `psql --username=freecodecamp --dbname=postgres` into the terminal to log in to psql if you aren't logged in first 56 | 57 | ## 50. View `first_database` 58 | 59 | ### 50.1 60 | 61 | Use the **l**ist shortcut command again to make sure your new database is there. 62 | 63 | #### HINTS 64 | 65 | - Type `\` followed by the "list" shortcut letter 66 | - Enter `\l` into the psql prompt and press enter 67 | - Type `psql --username=freecodecamp --dbname=postgres` into the terminal to log in to psql if you aren't logged in first 68 | 69 | ## 60. Create `second_database` 70 | 71 | ### 60.1 72 | 73 | It worked. Your new database is there. If you don't get a message after entering a command, it means it's incomplete and you likely forgot the semi-colon. You can just add it on the next line and press enter to finish the command. Create another database named `second_database`. 74 | 75 | #### HINTS 76 | 77 | - Use the "CREATE DATABASE" keywords 78 | - Here's the example again: `CREATE DATABASE database_name;` 79 | - Don't forget the semi-colon 80 | - Try entering `CREATE DATABASE second_database;` 81 | - Type `psql --username=freecodecamp --dbname=postgres` into the terminal to log in to psql if you aren't logged in first 82 | 83 | ## 70. View Databases 84 | 85 | ### 70.1 86 | 87 | You should have another new database now. **L**ist the databases to make sure. 88 | 89 | #### HINTS 90 | 91 | - Use the **l**ist shortcut command 92 | - Enter `\l` into the prompt 93 | - Type `psql --username=freecodecamp --dbname=postgres` into the terminal to log in to psql if you aren't logged in first 94 | 95 | ## 80. Connect to `second_database` 96 | 97 | ### 80.1 98 | 99 | You can **c**onnect to a database by entering `\c database_name`. You need to connect to add information. Connect to your `second_database`. 100 | 101 | #### HINTS 102 | 103 | - Enter `\c second_database` into the psql prompt to connect 104 | - Type `psql --username=freecodecamp --dbname=postgres` into the terminal to log in to psql if you aren't logged in first 105 | 106 | ## 90. View `second_database` Tables 107 | 108 | ### 90.1 109 | 110 | You should see a message that you are connected. Notice that the prompt changed to `second_database=>`. So the `postgres=>` prompt before must have meant you were connected to that database. A database is made of tables that hold your data. Enter `\d` to **d**isplay the tables. 111 | 112 | #### HINTS 113 | 114 | - Type `\d` in the prompt and press enter 115 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 116 | 117 | ## 100. Create `first_table` 118 | 119 | ### 100.1 120 | 121 | Looks like there's no tables or relations yet. Similar to how you created a database, you can create a table like this: 122 | 123 | ```sql 124 | CREATE TABLE table_name(); 125 | ``` 126 | 127 | Note that the parenthesis are needed for this one. It will create the table in the database you are connected to. Create a table named `first_table` in `second_database`. 128 | 129 | #### HINTS 130 | 131 | - Enter `CREATE TABLE first_table();` into the prompt 132 | - Don't forget the semi-colon 133 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 134 | 135 | ## 110. View `second_database` Tables 136 | 137 | ### 110.1 138 | 139 | View the tables in `second_database` again with the **d**isplay command. You should see your new table there with a little meta data about it. 140 | 141 | #### HINTS 142 | 143 | - Use the **d**isplay shortcut command 144 | - Try entering `\d` into the prompt 145 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 146 | 147 | ## 120. Create `second_table` 148 | 149 | ### 120.1 150 | 151 | Create another new table in this database. Give it a name of `second_table`. 152 | 153 | #### HINTS 154 | 155 | - Use the "CREATE TABLE" keywords 156 | - Don't forget the parenthesis and semi-colon at the end 157 | - Here's an example: `CREATE TABLE table_name();` 158 | - Enter `CREATE TABLE second_table();` into the prompt 159 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 160 | 161 | ## 130. View `second_database` Tables 162 | 163 | ### 130.1 164 | 165 | There should be two tables in this database now. **D**isplay them again to make sure. 166 | 167 | #### HINTS 168 | 169 | - Use the **display** shortcut command 170 | - Enter `\d` into the prompt 171 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 172 | 173 | ## 140. View `second_table` Details 174 | 175 | ### 140.1 176 | 177 | You can view more details about a table by adding the table name after the **d**isplay command like this: `\d table_name`. View more details about your `second_table`. 178 | 179 | #### HINTS 180 | 181 | - Enter `\d second_table` into the prompt 182 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 183 | 184 | ## 150. Create `first_column` 185 | 186 | ### 150.1 187 | 188 | Tables need **columns** to describe the data in them, yours doesn't have any yet. Here's an example of how to add one: 189 | 190 | ```sql 191 | ALTER TABLE table_name ADD COLUMN column_name DATATYPE; 192 | ``` 193 | 194 | Add a column to `second_table` named `first_column`. Give it a data type of `INT`. `INT` stands for integer. Don't forget the semi-colon. :smile: 195 | 196 | #### HINTS 197 | 198 | - Try entering `ALTER TABLE second_table ADD COLUMN first_column INT;` 199 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 200 | 201 | ## 160. View `second_table` Details 202 | 203 | ### 160.1 204 | 205 | Looks like it worked. **D**isplay the details of `second_table` again to see if your new column is there. 206 | 207 | #### HINTS 208 | 209 | - Use the **d**isplay shortcut command 210 | - Put the table name after the command 211 | - Here's an example: `\d table_name` 212 | - Try entering `\d second_table` 213 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 214 | 215 | ## 170. Add `id` Column 216 | 217 | ### 170.1 218 | 219 | Your column is there :smile: Use `ALTER TABLE` and `ADD COLUMN` to add another column to `second_table` named `id` that's a type of `INT`. 220 | 221 | #### HINTS 222 | 223 | - Here's the example again: `ALTER TABLE table_name ADD COLUMN column_name DATATYPE;` 224 | - Don't forget the semi-colon :wink: 225 | - You added the last column with: `ALTER TABLE second_table ADD COLUMN first_column INT;` 226 | - Try entering `ALTER TABLE second_table ADD COLUMN id INT;` 227 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 228 | 229 | ## 180. View `second_table` Details 230 | 231 | ### 180.1 232 | 233 | Your table should have an `id` column added. View the details of `second_table` to make sure. 234 | 235 | #### HINTS 236 | 237 | - Use the **d**isplay command 238 | - Add a table name after the **d**isplay command to view details 239 | - Here's an example: `\d table_name` 240 | - Try entering `\d second_table` 241 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 242 | 243 | ## 190. Add `age` Column 244 | 245 | ### 190.1 246 | 247 | Add another column to `second_table` named `age`. Give it a data type of `INT`. 248 | 249 | #### HINTS 250 | 251 | - Use the `ALTER TABLE` and `ADD COLUMN` keywords 252 | - Here's the example again: `ALTER TABLE table_name ADD COLUMN column_name DATATYPE;` 253 | - You added the last column with: `ALTER TABLE second_table ADD COLUMN id INT;` 254 | - Try using `ALTER TABLE second_table ADD COLUMN age INT;` 255 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 256 | 257 | ## 200. View `second_table` Details 258 | 259 | ### 200.1 260 | 261 | Take a look at the details of `second_table` again. 262 | 263 | #### HINTS 264 | 265 | - Use the **d**isplay shortcut command 266 | - Add the table name to the shortcut command to see details 267 | - Here's an example: `\d table_name` 268 | - Enter `\d second_table` 269 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 270 | 271 | ## 210. Drop `age` Column 272 | 273 | ### 210.1 274 | 275 | Those are some good looking columns. You will probably need to know how to remove them. Here's an example: 276 | 277 | ```sql 278 | ALTER TABLE table_name DROP COLUMN column_name; 279 | ``` 280 | 281 | Drop your `age` column. 282 | 283 | #### HINTS 284 | 285 | - Try entering `ALTER TABLE second_table DROP COLUMN age;` 286 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 287 | 288 | ## 220. View `second_table` Details 289 | 290 | ### 220.1 291 | 292 | View the details of `second_table` to see if it's gone. 293 | 294 | #### HINTS 295 | 296 | - Use the **d**isplay shortcut command 297 | - Add the table name to the shortcut command to see details 298 | - Here's an example: `\d table_name` 299 | - Enter `\d second_table` 300 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 301 | 302 | ## 230. Drop `first_column` Column 303 | 304 | ### 230.1 305 | 306 | It's gone. Use the `ALTER TABLE` and `DROP COLUMN` keywords again to drop `first_column`. 307 | 308 | #### HINTS 309 | 310 | - Here's the example again: `ALTER TABLE table_name DROP COLUMN column_name;` 311 | - You dropped the last column with: `ALTER TABLE second_table DROP COLUMN age;` 312 | - Try entering `ALTER TABLE second_table DROP COLUMN first_column;` 313 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 314 | 315 | ## 240. Add `name` Column 316 | 317 | ### 240.1 318 | 319 | A common data type is `VARCHAR`. It's a short string of characters. You need to give it a maximum length when using it like this: `VARCHAR(30)`. 320 | 321 | Add a new column to `second_table`, give it a name of `name` and a data type of `VARCHAR(30)`. 322 | 323 | #### HINTS 324 | 325 | - Use the `ALTER TABLE` and `ADD COLUMN` keywords 326 | - Here's an example: `ALTER TABLE table_name ADD COLUMN column_name DATATYPE;` 327 | - You added the last column like this: `ALTER TABLE second_table ADD COLUMN age INT;` 328 | - Try entering `ALTER TABLE second_table ADD COLUMN name VARCHAR(30);` 329 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 330 | 331 | ## 250. View `second_table` Details 332 | 333 | ### 250.1 334 | 335 | Take a look at the details of `second_table` to see your columns. 336 | 337 | #### HINTS 338 | 339 | - Use the **d**isplay shortcut command 340 | - Here's an example: `\d table_name` 341 | - Try entering `\d second_table` 342 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 343 | 344 | ## 260. Rename `name` Column 345 | 346 | ### 260.1 347 | 348 | You can see the `VARCHAR` type there. The `30` means the data in it can be a max of 30 characters. You named that column `name`, it should have been `username`. Here's how you can rename a column: 349 | 350 | ```sql 351 | ALTER TABLE table_name RENAME COLUMN column_name TO new_name; 352 | ``` 353 | 354 | Rename the `name` column to `username`. 355 | 356 | #### HINTS 357 | 358 | - Use `second_table` as the table name, `name` as the column name, and `username` as the new name for the column 359 | - Try entering `ALTER TABLE second_table RENAME COLUMN name TO username;` 360 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 361 | 362 | ## 270. View `second_table` Details 363 | 364 | ### 270.1 365 | 366 | Take a look at the details of `second_table` again to see if it got renamed. 367 | 368 | #### HINTS 369 | 370 | - Use the **d**isplay shortcut command 371 | - Here's an example: `\d table_name` 372 | - Enter `\d second_table` 373 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 374 | 375 | ## 280. Insert Samus Row 376 | 377 | ### 280.1 378 | 379 | It worked. Rows are the actual data in the table. You can add one like this: 380 | 381 | ```sql 382 | INSERT INTO table_name(column_1, column_2) VALUES(value1, value2); 383 | ``` 384 | 385 | Insert a row into `second_table`. Give it an `id` of `1`, and a `username` of `Samus`. The username column expects a `VARCHAR`, so you need to put Samus in single quotes like this: `'Samus'`. 386 | 387 | #### HINTS 388 | 389 | - The table is `second_table`, the column names are `id` and `username`, and the values to add are `1` and `'Samus'` 390 | - Don't forget the semi-colon 391 | - Try entering `INSERT INTO second_table(id, username) VALUES(1, 'Samus');` 392 | - If you missed a matching single quote, try entering `');` to finish the command and try again 393 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 394 | 395 | ## 290. View `second_table` Data 396 | 397 | ### 290.1 398 | 399 | You should have one row in your table. You can view the data in a table by querying it with the `SELECT` statement. Here's how it looks: 400 | 401 | ```sql 402 | SELECT columns FROM table_name; 403 | ``` 404 | 405 | Use a `SELECT` statement to view **all** the columns in `second_table`. Use an asterisk (`*`) to denote that you want to see all the columns. 406 | 407 | #### HINTS 408 | 409 | - Replace `columns` in the example with the all (`*`) symbol 410 | - Use `second_table` as the table name 411 | - Enter `SELECT * FROM second_table;` 412 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 413 | 414 | ## 300. Insert Mario Row 415 | 416 | ### 300.1 417 | 418 | There's your one row. **Insert** another row **into** `second_table`. Fill in the `id` and `username` columns with the **values** `2` and `'Mario'`. 419 | 420 | #### HINTS 421 | 422 | - Here's the example: `INSERT INTO table_name(column_1, column_2) VALUES(value1, value2);` 423 | - Did you make `Mario` a string? 424 | - You added the last row with `INSERT INTO second_table(id, username) VALUES(1, 'Samus');` 425 | - Try entering `INSERT INTO second_table(id, username) VALUES(2, 'Mario');` 426 | - If you missed a matching single quote, try entering `');` to finish the command 427 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 428 | 429 | ## 310. View `second_table` Data 430 | 431 | ### 310.1 432 | 433 | You should now have two rows in the table. Use `SELECT` again to view **all** the columns and rows **from** `second_table`. 434 | 435 | #### HINTS 436 | 437 | - Here's the example: `SELECT columns FROM table_name;` 438 | - Use `*` to see all columns 439 | - Try entering `SELECT * FROM second_table;` 440 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 441 | 442 | ## 320. Insert Luigi Row 443 | 444 | ### 320.1 445 | 446 | **Insert** another row **into** `second_table`. Use `3` as the `id`, and `Luigi` as the `username` this time. 447 | 448 | #### HINTS 449 | 450 | - Did you put `Luigi` in single quotes? 451 | - Here's the example: `INSERT INTO table_name(column_1, column_2) VALUES(value1, value2);` 452 | - You added the last row with `INSERT INTO second_table(id, username) VALUES(2, 'Mario');` 453 | - Try entering `INSERT INTO second_table(id, username) VALUES(3, 'Luigi');` 454 | - If you missed a matching single quote, try entering `');` to finish the command 455 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 456 | 457 | ## 330. View `second_table` Data 458 | 459 | ### 330.1 460 | 461 | You should now have three rows. Use `SELECT` again to see **all** the data you entered. 462 | 463 | #### HINTS 464 | 465 | - Here's the example again: `SELECT columns FROM table_name;` 466 | - Use `*` to see all columns 467 | - Try entering `SELECT * FROM second_table;` 468 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 469 | 470 | ## 340. Delete Luigi Row 471 | 472 | ### 340.1 473 | 474 | That gives me an idea :smiley: You can make a database of Mario video game characters. You should start from scratch for it. Why don't you delete the record you just entered. Here's an example of how to delete a row: 475 | 476 | ```sql 477 | DELETE FROM table_name WHERE condition; 478 | ``` 479 | 480 | Remove Luigi from your table. The condition you want to use is `username='Luigi'`. 481 | 482 | #### HINTS 483 | 484 | - Check your table name and condition closely 485 | - Try entering `DELETE FROM second_table WHERE username='Luigi';` 486 | - If you missed a matching single quote, try entering `');` to finish the command 487 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 488 | 489 | ## 350. View `second_table` Data 490 | 491 | ### 350.1 492 | 493 | Luigi should be gone. Use `SELECT` again to see all the data and make sure he's not there. 494 | 495 | #### HINTS 496 | 497 | - Here's the example: `SELECT columns FROM table_name;` 498 | - Use `*` to see all the columns 499 | - Try `SELECT * FROM second_table;` 500 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 501 | 502 | ## 360. Delete Mario Row 503 | 504 | ### 360.1 505 | 506 | It's gone. You can scrap all this for the new database. **Delete** Mario **from** `second_table` using the same command as before, except make the condition `username='Mario'` this time. 507 | 508 | #### HINTS 509 | 510 | - Use the `DELETE FROM` and `WHERE` keywords 511 | - Here's the example: `DELETE FROM table_name WHERE condition;` 512 | - You deleted Luigi with `DELETE FROM second_table WHERE username='Luigi';` 513 | - Try entering `DELETE FROM second_table WHERE username='Mario';` 514 | - If you missed a matching single quote, try entering `');` to finish the command 515 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 516 | 517 | ## 370. Delete Samus Row 518 | 519 | ### 370.1 520 | 521 | Only one more row should remain. **Delete** Samus **from** `second_table`. 522 | 523 | #### HINTS 524 | 525 | - Here's the example: `DELETE FROM table_name WHERE condition;` 526 | - You deleted Mario with `DELETE FROM second_table WHERE username='Mario';` 527 | - Use `username='Samus'` as the condition 528 | - Try entering `DELETE FROM second_table WHERE username='Samus';` 529 | - If you missed a matching single quote, try entering `');` to finish the command 530 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 531 | 532 | ## 380. View `second_table` Data 533 | 534 | ### 380.1 535 | 536 | Use `SELECT` again to see all the rows in `second_table` to make sure they're gone. 537 | 538 | #### HINTS 539 | 540 | - Here's the example `SELECT columns FROM table_name;` 541 | - Use `*` to see all columns 542 | - Enter `SELECT * FROM second_table;` 543 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 544 | 545 | ## 390. View `second_table` Details 546 | 547 | ### 390.1 548 | 549 | Looks like they're all gone. Remind yourself what columns you have in `second_table` by looking at its **d**etails. 550 | 551 | #### HINTS 552 | 553 | - Use the **d**isplay shortcut command 554 | - Add the table name after the shortcut command 555 | - Here's an example: `\d table_name` 556 | - Try `\d second_table` 557 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 558 | 559 | ## 400. Drop `username` Column 560 | 561 | ### 400.1 562 | 563 | There's two columns. You won't need either of them for the Mario database. **Alter** the **table** `second_table` and **drop** the **column** `username`. 564 | 565 | #### HINTS 566 | 567 | - Use the `ALTER TABLE` and `DROP COLUMN` keywords 568 | - Here's an example: `ALTER TABLE table_name DROP COLUMN column_name;` 569 | - You dropped a column before with: `ALTER TABLE second_table DROP COLUMN age;` 570 | - Try `ALTER TABLE second_table DROP COLUMN username;` 571 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 572 | 573 | ## 410. Drop `id` Column 574 | 575 | ### 410.1 576 | 577 | Next, drop the `id` column. 578 | 579 | #### HINTS 580 | 581 | - Use the `ALTER TABLE` and `DROP COLUMN` keywords 582 | - Here's an example: `ALTER TABLE table_name DROP COLUMN column_name;` 583 | - You previously dropped a column with `ALTER TABLE second_table DROP COLUMN username;` 584 | - Enter `ALTER TABLE second_table DROP COLUMN id;` in the psql prompt 585 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 586 | 587 | ## 420. View `second_database` Tables 588 | 589 | ### 420.1 590 | 591 | Okay, the table has no rows or columns left. View the tables in this database to see what is here. 592 | 593 | #### HINTS 594 | 595 | - Use the **d**isplay shortcut command 596 | - You don't need a table name with the command 597 | - Try entering `\d` 598 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 599 | 600 | ## 430. Drop `second_table` 601 | 602 | ### 430.1 603 | 604 | Still two. You won't need either of those for the new database either. Drop `second_table` from your database. Here's an example: 605 | 606 | ```sql 607 | DROP TABLE table_name; 608 | ``` 609 | 610 | #### HINTS 611 | 612 | - Enter `DROP TABLE second_table;` in the psql prompt 613 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 614 | 615 | ## 440. Drop `first_table` 616 | 617 | ### 440.1 618 | 619 | Next, drop `first_table` from the database. 620 | 621 | #### HINTS 622 | 623 | - Here's an example: `DROP TABLE table_name;` 624 | - Enter `DROP TABLE first_table;` in the psql prompt 625 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 626 | 627 | ## 450. View Databases 628 | 629 | ### 450.1 630 | 631 | All the tables are gone now, too. View all the databases using the command to **l**ist them. 632 | 633 | #### HINTS 634 | 635 | - Use the **l**ist shortcut command 636 | - Enter `\l` in the psql prompt 637 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 638 | 639 | ## 460. Rename `first_database` 640 | 641 | ### 460.1 642 | 643 | Rename `first_database` to `mario_database`. You can rename a database like this: 644 | 645 | ```sql 646 | ALTER DATABASE database_name RENAME TO new_database_name; 647 | ``` 648 | 649 | #### HINTS 650 | 651 | - Try entering `ALTER DATABASE first_database RENAME TO mario_database;` 652 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 653 | 654 | ## 470. View Databases 655 | 656 | ### 470.1 657 | 658 | List the databases to make sure it got renamed. 659 | 660 | #### HINTS 661 | 662 | - Use the **l**ist shortcut command 663 | - Enter `\l` 664 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 665 | 666 | ## 480. Connect to `mario_database` 667 | 668 | ### 480.1 669 | 670 | **C**onnect to your newly named database so you can start adding your characters. 671 | 672 | #### HINTS 673 | 674 | - Use the `\c` shortcut command to connect to a database 675 | - Add the database name after the command 676 | - Here's an example: `\c database_name` 677 | - Enter `\c mario_database` 678 | - Enter `psql --username=freecodecamp --dbname=second_database` into the terminal to log in if you aren't already 679 | 680 | ## 490. Drop `second_database` 681 | 682 | ### 490.1 683 | 684 | Now that you aren't connected to `second_database`, you can drop it. Use the `DROP DATABASE` keywords to do that. 685 | 686 | #### HINTS 687 | 688 | - Add the database name after the keywords 689 | - Don't forget the semi-colon 690 | - Here's an example: `DROP DATABASE database_name;` 691 | - Enter `DROP DATABASE second_database;` 692 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 693 | 694 | ## 500. View Databases 695 | 696 | ### 500.1 697 | 698 | List the databases again to make sure it's gone. 699 | 700 | #### HINTS 701 | 702 | - Use the **l**ist shortcut command 703 | - Enter `\l` 704 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 705 | 706 | ## 530. Display `mario_database` Tables 707 | 708 | ### 530.1 709 | 710 | Okay, I think you're ready to get started. I don't think you created any tables here, take a look to make sure. 711 | 712 | #### HINTS 713 | 714 | - Use the **d**isplay shortcut command 715 | - Try entering `\d` 716 | - Try entering `\c mario_database` 717 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 718 | 719 | ## 540. Create `characters` Table 720 | 721 | ### 540.1 722 | 723 | Create a new table named `characters`, it will hold some basic information about Mario characters. 724 | 725 | #### HINTS 726 | 727 | - Use the `CREATE TABLE` keywords 728 | - Don't forget the parenthesis and semi-colon at the end 729 | - Here's an example: `CREATE TABLE table_name();` 730 | - Try entering `CREATE TABLE characters();` 731 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 732 | 733 | ## 550. Add `character_id` column 734 | 735 | ### 550.1 736 | 737 | Next, you can add some columns to the table. Add a column named `character_id` to your new table that is a type of `SERIAL`. 738 | 739 | #### HINTS 740 | 741 | - Use the `ALTER TABLE` and `ADD COLUMN` keywords 742 | - Here's an example: `ALTER TABLE table_name ADD COLUMN column_name TYPE;` 743 | - Try entering `ALTER TABLE characters ADD COLUMN character_id SERIAL;` 744 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 745 | 746 | ## 560. View `characters` Details 747 | 748 | ### 560.1 749 | 750 | The `SERIAL` type will make your column an `INT` with a `NOT NULL` constraint, and automatically increment the integer when a new row is added. View the details of the `characters` table to see what `SERIAL` did for you. 751 | 752 | #### HINTS 753 | 754 | - Use the **d**isplay shortcut command 755 | - Here's an example: `\d table_name` 756 | - Try entering `\d characters` 757 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 758 | 759 | ## 570. Add `name` Column 760 | 761 | ### 570.1 762 | 763 | Add a column to `characters` called `name`. Give it a data type of `VARCHAR(30)`, and a constraint of `NOT NULL`. Add a constraint by putting it right after the data type. 764 | 765 | #### HINTS 766 | 767 | - Use the `ALTER TABLE` and `ADD COLUMN` keywords 768 | - Here's an example: `ALTER TABLE table_name ADD COLUMN column_name DATATYPE CONSTRAINT;` 769 | - Try entering `ALTER TABLE characters ADD COLUMN name VARCHAR(30) NOT NULL;` in the psql prompt 770 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 771 | 772 | ## 580. Add `homeland` Column 773 | 774 | ### 580.1 775 | 776 | You can make another column for where they are from. Add another column named `homeland`. Give it a data type of `VARCHAR` that has a max length of `60`. 777 | 778 | #### HINTS 779 | 780 | - Use the `ALTER TABLE` and `ADD COLUMN` keywords 781 | - Here's an example: `ALTER TABLE table_name ADD COLUMN column_name DATATYPE;` 782 | - Try entering `ALTER TABLE characters ADD COLUMN homeland VARCHAR(60);` 783 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 784 | 785 | ## 590. Add `favorite_color` Column 786 | 787 | ### 590.1 788 | 789 | Video game characters are quite colorful. Add one more column named `favorite_color`. Make it a `VARCHAR` with a max length of `30`. 790 | 791 | #### HINTS 792 | 793 | - Use the `ALTER TABLE` and `ADD COLUMN` keywords 794 | - Here's an example: `ALTER TABLE table_name ADD COLUMN column_name DATATYPE;` 795 | - Try entering `ALTER TABLE characters ADD COLUMN favorite_color VARCHAR(30);` 796 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 797 | 798 | ## 600. View `characters` Details 799 | 800 | ### 600.1 801 | 802 | You should have four columns in `characters`. Take a look at the details of it to see how things are going. 803 | 804 | #### HINTS 805 | 806 | - Use the **d**isplay shortcut command 807 | - Add a table name to the shortcut command to see details 808 | - Here's an example: `\d table_name` 809 | - Try entering `\d characters` 810 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 811 | 812 | ## 610. Insert Mario Row 813 | 814 | ### 610.1 815 | 816 | You are ready to start adding some rows. First is Mario. Earlier, you used this command to add a row: 817 | 818 | ```sql 819 | INSERT INTO second_table(id, username) VALUES(1, 'Samus'); 820 | ``` 821 | 822 | The first parenthesis is for the column names, you can put as many columns as you want. The second parenthesis is for the values for those columns. Add a row to your table, give it a `name` of `Mario`, a `homeland` of `Mushroom Kingdom`, and a `favorite_color` of `Red`. Make sure to use single quotes where needed. 823 | 824 | #### HINTS 825 | 826 | - Here's an example: `INSERT INTO table_name(column1, column2, column3) VALUES(value1, value2, value3);` 827 | - Try using `INSERT INTO characters(name, homeland, favorite_color) VALUES('Mario', 'Mushroom Kingdom', 'Red');` 828 | - If you missed a matching single quote, try entering `');` to finish the command 829 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 830 | 831 | ## 620. View `characters` Data 832 | 833 | ### 620.1 834 | 835 | Mario should have a row now and his `character_id` should have been automatically added. View **all** the data in your `characters` table with `SELECT` to see this. 836 | 837 | #### HINTS 838 | 839 | - Use the `SELECT` and `FROM` keywords 840 | - Here's an example: `SELECT columns FROM table_name;` 841 | - Use `*` to see all columns 842 | - Try entering `SELECT * FROM characters;` 843 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 844 | 845 | ## 630. Insert Luigi Row 846 | 847 | ### 630.1 848 | 849 | Add another row for Luigi. Give it a `name` of `Luigi`, a `homeland` of `Mushroom Kingdom`, and a `favorite_color` of `Green`. 850 | 851 | #### HINTS 852 | 853 | - Use the `INSERT INTO` and `VALUES` keywords 854 | - Here's an example: `INSERT INTO table_name(column1, column2, column3) VALUES(value1, value2, value3);` 855 | - Don't forget the quotes and semi-colon 856 | - Try using `INSERT INTO characters(name, homeland, favorite_color) VALUES('Luigi', 'Mushroom Kingdom', 'Green');` 857 | - If you missed a matching single quote, try entering `');` to finish the command 858 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 859 | 860 | ## 640. View `characters` Data 861 | 862 | ### 640.1 863 | 864 | View all the data in your `characters` table with `SELECT` again. 865 | 866 | #### HINTS 867 | 868 | - Use the `SELECT` and `FROM` keywords 869 | - Here's an example: `SELECT columns FROM table_name;` 870 | - Use `*` to see all columns 871 | - Try entering `SELECT * FROM characters;` 872 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 873 | 874 | ## 650. Insert Peach Row 875 | 876 | ### 650.1 877 | 878 | Okay, it looks like it's all working. Add another row for Peach. Give her the values: `Peach`, `Mushroom Kingdom`, and `Pink`. 879 | 880 | #### HINTS 881 | 882 | - Use the `INSERT INTO` and `VALUES` keywords 883 | - Here's an example: `INSERT INTO table_name(column1, column2, column3) VALUES(value1, value2, value3);` 884 | - Don't forget the quotes and semi-colon 885 | - Try using `INSERT INTO characters(name, homeland, favorite_color) VALUES('Peach', 'Mushroom Kingdom', 'Pink');` 886 | - If you missed a matching single quote, try entering `');` to finish the command 887 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 888 | 889 | ## 660. Add Toadstool and Bowser Rows 890 | 891 | ### 660.1 892 | 893 | Adding rows one at a time is quite tedious. Here's an example of how you could have added the previous three rows at once: 894 | 895 | ```sql 896 | INSERT INTO characters(name, homeland, favorite_color) 897 | VALUES('Mario', 'Mushroom Kingdom', 'Red'), 898 | ('Luigi', 'Mushroom Kingdom', 'Green'), 899 | ('Peach', 'Mushroom Kingdom', 'Pink'); 900 | ``` 901 | 902 | Add two more rows. Give the first one the values: `Toadstool`, `Mushroom Kingdom`, and `Red`. Give the second one: `Bowser`, `Mushroom Kingdom`, and `Green`. Try to add them with one command. 903 | 904 | #### HINTS 905 | 906 | - Make sure you added commas and quotes where needed 907 | - Try entering `INSERT INTO characters(name, homeland, favorite_color) VALUES('Toadstool', 'Mushroom Kingdom', 'Red'), ('Bowser', 'Mushroom Kingdom', 'Green');` in the psql prompt 908 | - If you missed a matching single quote, try entering `');` to finish the command 909 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 910 | 911 | ## 670. Add Daisy and Yoshi Rows 912 | 913 | ### 670.1 914 | 915 | If you don't get a message after a command, it is likely incomplete. This is because you can put a command on multiple lines. Add two more rows. Give the first one the values: `Daisy`, `Sarasaland`, and `Yellow`. The second: `Yoshi`, `Dinosaur Land`, and `Green`. Try to do it with one command. 916 | 917 | #### HINTS 918 | 919 | - Make sure you added commas and quotes where needed 920 | - You previously used `INSERT INTO characters(name, homeland, favorite_color) VALUES('Toadstool', 'Mushroom Kingdom', 'Red'), ('Bowser', 'Mushroom Kingdom', 'Green');` 921 | - Try entering `INSERT INTO characters(name, homeland, favorite_color) VALUES('Daisy', 'Sarasaland', 'Yellow'), ('Yoshi', 'Dinosaur Land', 'Green');` 922 | - If you missed a matching single quote, try entering `');` to finish the command 923 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 924 | 925 | ## 680. View `characters` Data 926 | 927 | ### 680.1 928 | 929 | Take a look at all the data in your table with `SELECT` to see where you stand. 930 | 931 | #### HINTS 932 | 933 | - Use the `SELECT` and `FROM` keywords 934 | - Here's an example: `SELECT columns FROM table_name;` 935 | - Use `*` to see all columns 936 | - Try `SELECT * FROM characters;` 937 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 938 | 939 | ## 690. Update Daisy's `favorite_color` 940 | 941 | ### 690.1 942 | 943 | It looks good, but there's a few mistakes. You can change a value like this: 944 | 945 | ```sql 946 | UPDATE table_name SET column_name=new_value WHERE condition; 947 | ``` 948 | 949 | You used `username='Samus'` as a condition earlier. `SET` Daisy's `favorite_color` to `Orange`. You can use the condition `name='Daisy'` to change her row. 950 | 951 | #### HINTS 952 | 953 | - There should be two sets of single quotes in this command 954 | - Without the keywords, it looks like this: `characters favorite_color='Orange' name='Daisy';` 955 | - Try `UPDATE characters SET favorite_color='Orange' WHERE name='Daisy';` 956 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 957 | 958 | ## 700. View `characters` Data 959 | 960 | ### 700.1 961 | 962 | The command you just used does exactly what it sounds like. It finds the row where `name` is `Daisy`, and sets her `favorite_color` to `Orange`. Take a look at all the data in your table again to see if she got updated. 963 | 964 | #### HINTS 965 | 966 | - Use the `SELECT` and `FROM` keywords 967 | - Here's an example: `SELECT columns FROM table_name;` 968 | - Use `*` to see all columns 969 | - Try `SELECT * FROM characters;` 970 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 971 | 972 | ## 710. Update Toadstool's `name` 973 | 974 | ### 710.1 975 | 976 | Her favorite color was updated. Toadstool's name is wrong as well, it's actually `Toad`. Use `UPDATE` to `SET` his `name` to `Toad`. Use the condition `favorite_color='Red'`. 977 | 978 | #### HINTS 979 | 980 | - Here's an example: `UPDATE table_name SET column_name=new_value WHERE condition;` 981 | - Here's the second part of the command: `SET name='Toad' WHERE favorite_color='Red';` 982 | - Try entering `UPDATE characters SET name='Toad' WHERE favorite_color='Red';` 983 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 984 | 985 | ## 720. View `characters` Data 986 | 987 | ### 720.1 988 | 989 | Take a look at all the data in your table. 990 | 991 | #### HINTS 992 | 993 | - Use the `SELECT` and `FROM` keywords 994 | - Here's an example: `SELECT columns FROM table_name;` 995 | - Use `*` to see all columns 996 | - Try `SELECT * FROM characters;` 997 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 998 | 999 | ## 730. Update Mario's `name` 1000 | 1001 | ### 730.1 1002 | 1003 | Using `favorite_color='Red'` was not a good idea. Mario's name changed to Toad because he likes red, and now there's two rows that are the same. Well, almost. Only the `character_id` is different. You will have to use that to change it back to `Mario`. Use `UPDATE` to set the `name` to `Mario` for the row with the lowest `character_id`. 1004 | 1005 | #### HINTS 1006 | 1007 | - Use the `UPDATE`, `SET`, and `WHERE` keywords and strings where needed 1008 | - Here's an example: `UPDATE table_name SET column_name=new_value WHERE condition;` 1009 | - Try entering `UPDATE characters SET name='Mario' WHERE character_id=1;` in the psql prompt. Or whatever the correct `character_id` is. 1010 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1011 | 1012 | ## 740. View `characters` Data 1013 | 1014 | ### 740.1 1015 | 1016 | Take a look at all the data in your table again to see if Mario's name got changed back. 1017 | 1018 | #### HINTS 1019 | 1020 | - Use the `SELECT` and `FROM` keywords 1021 | - Here's an example: `SELECT columns FROM table_name;` 1022 | - Use `*` to see all columns 1023 | - Try `SELECT * FROM characters;` 1024 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1025 | 1026 | ## 750. Update Toad's `favorite_color` 1027 | 1028 | ### 750.1 1029 | 1030 | Looks like it worked. Toad's favorite color is wrong. He likes blue. Change Toad's favorite color to `Blue`. Use whatever condition you want, but don't change any of the other rows. 1031 | 1032 | #### HINTS 1033 | 1034 | - Use the `UPDATE`, `SET`, and `WHERE` keywords 1035 | - Here's an example: `UPDATE table_name SET column_name=newvalue WHERE condition;` 1036 | - I recommend using `character_id=4` as the condition 1037 | - Try entering `UPDATE characters SET favorite_color='Blue' WHERE character_id=4;` 1038 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1039 | 1040 | ## 760. Update Bowser's `favorite_color` 1041 | 1042 | ### 760.1 1043 | 1044 | Bowser's `favorite_color` is wrong. He likes `Yellow`. Why don't you update it without changing any of the other rows? 1045 | 1046 | #### HINTS 1047 | 1048 | - Use the `UPDATE`, `SET`, and `WHERE` keywords 1049 | - Here's an example: `UPDATE table_name SET column_name=new_value WHERE condition;` 1050 | - I recommend using `character_id=5` as the condition 1051 | - Try entering `UPDATE characters SET favorite_color='Yellow' WHERE character_id=5;` 1052 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1053 | 1054 | ## 770. Update Bowser's `homeland` 1055 | 1056 | ### 770.1 1057 | 1058 | Bowser's `homeland` is wrong as well. He's from the `Koopa Kingdom`. Why don't you change it to that without changing any other rows? 1059 | 1060 | #### HINTS 1061 | 1062 | - Use the `UPDATE`, `SET`, and `WHERE` keywords 1063 | - Here's an example: `UPDATE table_name SET column_name=new_value WHERE condition;` 1064 | - I recommend using `character_id=5` as the condition 1065 | - Try entering `UPDATE characters SET homeland='Koopa Kingdom' WHERE character_id=5;` 1066 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1067 | 1068 | ## 780. View `characters` Data 1069 | 1070 | ### 780.1 1071 | 1072 | Take a look at all the data in your table again to make sure there's no more issues. 1073 | 1074 | #### HINTS 1075 | 1076 | - Use the `SELECT` and `FROM` keywords 1077 | - Here's an example; `SELECT rows FROM table_name;` 1078 | - Try entering `SELECT * FROM characters;` 1079 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1080 | 1081 | ## 790. View Sorted `characters` Data 1082 | 1083 | ### 790.1 1084 | 1085 | Actually, you should put that in order. Here's an example: 1086 | 1087 | ```sql 1088 | SELECT columns FROM table_name ORDER BY column_name; 1089 | ``` 1090 | 1091 | View all the data again, but put it in order by `character_id`. 1092 | 1093 | #### HINTS 1094 | 1095 | - Try entering `SELECT * FROM characters ORDER BY character_id;` 1096 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1097 | 1098 | ## 800. Add `name` Primary Key 1099 | 1100 | ### 800.1 1101 | 1102 | It looks good. Next, you are going to add a **primary key**. It's a column that uniquely identifies each row in the table. Here's an example of how to set a `PRIMARY KEY`: 1103 | 1104 | ```sql 1105 | ALTER TABLE table_name ADD PRIMARY KEY(column_name); 1106 | ``` 1107 | 1108 | The `name` column is pretty unique, why don't you set that as the primary key for this table. 1109 | 1110 | #### HINTS 1111 | 1112 | - You don't need quotes, but you do need a semi-colon :smile: 1113 | - Try entering `ALTER TABLE characters ADD PRIMARY KEY(name);` 1114 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1115 | 1116 | ## 810. View `characters` Details 1117 | 1118 | ### 810.1 1119 | 1120 | You should set a primary key on every table and there can only be one per table. Take a look at the details of your `characters` table to see the primary key at the bottom. 1121 | 1122 | #### HINTS 1123 | 1124 | - Use the **d**isplay shortcut command 1125 | - Here's an example: `\d table_name` 1126 | - Try entering `\d characters` 1127 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1128 | 1129 | ## 820. Drop `name` Primary Key 1130 | 1131 | ### 820.1 1132 | 1133 | You can see the key for your `name` column at the bottom. It would have been better to use `character_id` for the primary key. Here's an example of how to drop a constraint: 1134 | 1135 | ```sql 1136 | ALTER TABLE table_name DROP CONSTRAINT constraint_name; 1137 | ``` 1138 | 1139 | Drop the primary key on the `name` column. You can see the **constraint name** is `characters_pkey`. 1140 | 1141 | #### HINTS 1142 | 1143 | - Try using `ALTER TABLE characters DROP CONSTRAINT characters_pkey;` 1144 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1145 | 1146 | ## 830. View `characters` Details 1147 | 1148 | ### 830.1 1149 | 1150 | View the details of the `characters` table to make sure it's gone. 1151 | 1152 | #### HINTS 1153 | 1154 | - Use the **d**isplay shortcut command 1155 | - Here's an example: `\d table_name` 1156 | - Try entering `\d characters` 1157 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1158 | 1159 | ## 840. Add `character_id` Primary Key 1160 | 1161 | ### 840.1 1162 | 1163 | It's gone. Set the primary key again, but use the `character_id` column this time. 1164 | 1165 | #### HINTS 1166 | 1167 | - Use the `ALTER TABLE` and `ADD PRIMARY KEY` keywords 1168 | - Here's an example: `ALTER TABLE table_name ADD PRIMARY KEY(column_name);` 1169 | - Try entering `ALTER TABLE characters ADD PRIMARY KEY(character_id);` 1170 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1171 | 1172 | ## 850. View `characters` Details 1173 | 1174 | ### 850.1 1175 | 1176 | View the details of the `characters` table to see the new primary key. 1177 | 1178 | #### HINTS 1179 | 1180 | - Use the **d**isplay shortcut command 1181 | - Here's an example: `\d table_name` 1182 | - Try entering `\d characters` 1183 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1184 | 1185 | ## 860. Create `more_info` Table 1186 | 1187 | ### 860.1 1188 | 1189 | That's better. The table looks complete for now. Next, create a new table named `more_info` for some extra info about the characters. 1190 | 1191 | #### HINTS 1192 | 1193 | - Use the `CREATE TABLE` keywords 1194 | - Here's an example: `CREATE TABLE table_name();` 1195 | - Try entering `CREATE TABLE more_info();` 1196 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1197 | 1198 | ## 870. View `mario_database` Tables 1199 | 1200 | ### 870.1 1201 | 1202 | View the tables in `mario_database` again with the **d**isplay command. You should have two tables now. 1203 | 1204 | #### HINTS 1205 | 1206 | - Don't put a table name after the command 1207 | - Enter the `\d` command 1208 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1209 | 1210 | ## 880. View `characters` Details 1211 | 1212 | ### 880.1 1213 | 1214 | I wonder what that third one is. It says `characters_character_id_seq`. I think I have a clue. View the details of the `characters` table. 1215 | 1216 | #### HINTS 1217 | 1218 | - Use the **d**isplay shortcut command 1219 | - Add the table name after the command 1220 | - You previously used `\d second_table` 1221 | - Enter `\d characters` 1222 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1223 | 1224 | ## 890. Create `more_info_id` Column 1225 | 1226 | ### 890.1 1227 | 1228 | That is what finds the next value for the `character_id` column. Add a column to your new table named `more_info_id`. Make it a type of `SERIAL`. 1229 | 1230 | #### HINTS 1231 | 1232 | - Use the `ALTER TABLE` and `ADD COLUMN` keywords 1233 | - Here's an example: `ALTER TABLE table_name ADD COLUMN column_name TYPE;` 1234 | - Try entering `ALTER TABLE more_info ADD COLUMN more_info_id SERIAL;` 1235 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1236 | 1237 | ## 895. Create `more_info` Primary Key 1238 | 1239 | ### 895.1 1240 | 1241 | Set your new column as the primary key for this table. 1242 | 1243 | #### HINTS 1244 | 1245 | - Use the `ALTER TABLE` and `ADD PRIMARY KEY` keywords 1246 | - Here's an example: `ALTER TABLE table_name ADD PRIMARY KEY(column_name);` 1247 | - Try entering `ALTER TABLE more_info ADD PRIMARY KEY(more_info_id);` 1248 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1249 | 1250 | ## 900. View `mario_database` Tables 1251 | 1252 | ### 900.1 1253 | 1254 | View the tables in `mario_database` again with the display command. There should be another sequence there for the `more_info_id` because it also automatically increments. 1255 | 1256 | #### HINTS 1257 | 1258 | - Enter the `\d` command 1259 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1260 | 1261 | ## 910. Add `birthday` Column 1262 | 1263 | ### 910.1 1264 | 1265 | There it is. Add another column to `more_info` named `birthday`. Give it a data type of `DATE`. 1266 | 1267 | #### HINTS 1268 | 1269 | - Use the `ALTER TABLE` and `ADD COLUMN` keywords 1270 | - Here's an example: `ALTER TABLE table_name ADD COLUMN column_name DATATYPE;` 1271 | - Try entering `ALTER TABLE more_info ADD COLUMN birthday DATE;` 1272 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1273 | 1274 | ## 920. Add `height` Column 1275 | 1276 | ### 920.1 1277 | 1278 | Add a `height` column to `more_info` that's a type of `INT`. 1279 | 1280 | #### HINTS 1281 | 1282 | - Use the `ALTER TABLE` and `ADD COLUMN` keywords 1283 | - Here's an example: `ALTER TABLE table_name ADD COLUMN column_name DATATYPE;` 1284 | - Try entering `ALTER TABLE more_info ADD COLUMN height INT;` 1285 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1286 | 1287 | ## 930. Add `weight` Columns 1288 | 1289 | ### 930.1 1290 | 1291 | Add a `weight` column. Give it a type of `NUMERIC(4, 1)`. That data type is for decimals. `NUMERIC(4, 1)` has up to four digits and one of them has to be to the right of the decimal. 1292 | 1293 | #### HINTS 1294 | 1295 | - Use the `ALTER TABLE` and `ADD COLUMN` keywords 1296 | - Here's an example: `ALTER TABLE table_name ADD COLUMN column_name DATATYPE;` 1297 | - Try entering `ALTER TABLE more_info ADD COLUMN weight NUMERIC(4, 1);` 1298 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1299 | 1300 | ## 940. View `more_info` Details 1301 | 1302 | ### 940.1 1303 | 1304 | Take a look at the details of `more_info` to see all your columns. 1305 | 1306 | #### HINTS 1307 | 1308 | - Use the **d**isplay shortcut command 1309 | - Here's an example: `\d table_name` 1310 | - Try entering `\d more_info` 1311 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1312 | 1313 | ## 950. Add `character_id` Foreign Key 1314 | 1315 | ### 950.1 1316 | 1317 | There’s your four columns and the primary key you created at the bottom. To know what row is for a character, you need to set a **foreign key** so you can relate rows from this table to rows from your `characters` table. Here's an example that creates a column as a foreign key: 1318 | 1319 | ```sql 1320 | ALTER TABLE table_name ADD COLUMN column_name DATATYPE REFERENCES referenced_table_name(referenced_column_name); 1321 | ``` 1322 | 1323 | That's quite the command. In the `more_info` table, create a `character_id` column. Make it an `INT` and a foreign key that references the `character_id` column from the `characters` table. Good luck. 1324 | 1325 | #### HINTS 1326 | 1327 | - You can do it! 1328 | - Give it one more try 1329 | - Without the keywords, it looks like this: `more_info character_id characters(character_id);` 1330 | - Try this `ALTER TABLE more_info ADD COLUMN character_id INT REFERENCES characters(character_id);` 1331 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1332 | 1333 | ## 960. View `more_info` Details 1334 | 1335 | ### 960.1 1336 | 1337 | To set a row in `more_info` for Mario, you just need to set the `character_id` (foreign key) value to whatever it is in the `characters` table. Take a look at the details of `more_info` to see your foreign key. 1338 | 1339 | #### HINTS 1340 | 1341 | - Use the **d**isplay shortcut command 1342 | - Here's an example: `\d table_name` 1343 | - Try entering `\d more_info` 1344 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1345 | 1346 | ## 970. Add `UNIQUE` 1347 | 1348 | ### 970.1 1349 | 1350 | There's your foreign key at the bottom. These tables have a "one-to-one" relationship. **One** row in the `characters` table will be related to exactly **one** row in `more_info` and vice versa. Enforce that by adding the `UNIQUE` constraint to your foreign key. Here's an example: 1351 | 1352 | ```sql 1353 | ALTER TABLE table_name ADD UNIQUE(column_name); 1354 | ``` 1355 | 1356 | Add the `UNIQUE` constraint to the column you just added. 1357 | 1358 | #### HINTS 1359 | 1360 | - It's the `character_id` column in `more_info` 1361 | - Try `ALTER TABLE more_info ADD UNIQUE(character_id);` 1362 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1363 | 1364 | ## 980. Add `NOT NULL` 1365 | 1366 | ### 980.1 1367 | 1368 | The column should also be `NOT NULL` since you don't want to have a row that is for nobody. Here's an example: 1369 | 1370 | ```sql 1371 | ALTER TABLE table_name ALTER COLUMN column_name SET NOT NULL; 1372 | ``` 1373 | 1374 | Add the `NOT NULL` constraint to your foreign key column. 1375 | 1376 | #### HINTS 1377 | 1378 | - The foreign key column is `character_id` in the `more_info` table 1379 | - Try `ALTER TABLE more_info ALTER COLUMN character_id SET NOT NULL;` 1380 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1381 | 1382 | ## 990. View `more_info` Details 1383 | 1384 | ### 990.1 1385 | 1386 | Take a look at the details of your `more_info` table to see all the keys and constraints you added. 1387 | 1388 | #### HINTS 1389 | 1390 | - Use the **d**isplay shortcut command 1391 | - Here's an example: `\d table_name` 1392 | - Try entering `\d more_info` 1393 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1394 | 1395 | ## 1000. Select `character_id` 1396 | 1397 | ### 1000.1 1398 | 1399 | The structure is set, now you can add some rows. First, you need to know what `character_id` you need for the foreign key column. You have viewed all columns in a table with `*`. You can pick columns by putting in the column name instead of `*`. Use `SELECT` to view the `character_id` column **from** the `characters` table. 1400 | 1401 | #### HINTS 1402 | 1403 | - Here's an example: `SELECT column FROM table_name;` 1404 | - Enter `SELECT character_id FROM characters;` in the psql prompt 1405 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1406 | 1407 | ## 1010. Select `character_id` and `name` 1408 | 1409 | ### 1010.1 1410 | 1411 | That list of numbers doesn't really help. Use `SELECT` again to display both the `character_id` and `name` columns from the `characters` table. You can separate the column names with a comma to view both. 1412 | 1413 | #### HINTS 1414 | 1415 | - Here's an example: `SELECT column1, column2 FROM table_name;` 1416 | - Try entering `SELECT character_id, name FROM characters;` 1417 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1418 | 1419 | ## 1020. Add `more_info` for Mario 1420 | 1421 | ### 1020.1 1422 | 1423 | That's better. You can see Mario's id there. Here's some more info for him: 1424 | 1425 | | birthday | height | weight | 1426 | | ---------- | ------ | ------ | 1427 | | 1981-07-09 | 155 | 64.5 | 1428 | 1429 | Add a row to `more_info` with the above data for Mario using the `INSERT INTO` and `VALUES` keywords. Be sure to set his `character_id` when adding him. Also, `DATE` values need a string with the format: `'YYYY-MM-DD'`. 1430 | 1431 | #### HINTS 1432 | 1433 | - Here's an example: `INSERT INTO table_name(columns) VALUES(values);` 1434 | - You previously used `INSERT INTO characters(name, homeland, favorite_color) VALUES('Luigi', 'Mushroom Kingdom', 'Green');` 1435 | - Try `INSERT INTO more_info(birthday, height, weight, character_id) VALUES('1981-07-09', 155, 64.5, 1);` 1436 | - Or, enter the above command and replace the `1` with the correct `character_id` 1437 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1438 | 1439 | ## 1030. View `more_info` Data 1440 | 1441 | ### 1030.1 1442 | 1443 | View all the data in `more_info` to make sure it's looking good. 1444 | 1445 | #### HINTS 1446 | 1447 | - Use the `SELECT` and `FROM` keywords 1448 | - Here's an example: `SELECT columns FROM table_name;` 1449 | - Use `*` to see all columns 1450 | - Try entering `SELECT * FROM more_info;` 1451 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1452 | 1453 | ## 1040. Select `character_id` and `name` 1454 | 1455 | ### 1040.1 1456 | 1457 | Next, you are going to add some info for Luigi. Use `SELECT` again to view the `character_id` and `name` columns **from** the `characters` table to find his id. 1458 | 1459 | #### HINTS 1460 | 1461 | - Here's an example: `SELECT column1, column2 FROM table_name;` 1462 | - Try entering `SELECT character_id, name FROM characters;` 1463 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1464 | 1465 | ## 1050. Add `more_info` for Luigi 1466 | 1467 | ### 1050.1 1468 | 1469 | You can see Luigi's id there. Here's his info: 1470 | 1471 | | birthday | height | weight | 1472 | | ---------- | ------ | ------ | 1473 | | 1983-07-14 | 175 | 48.8 | 1474 | 1475 | Add a row in `more_info` for Luigi using the above info. Be sure to add his `character_id` as well. 1476 | 1477 | #### HINTS 1478 | 1479 | - Use the `INSERT INTO` and `VALUES` keywords 1480 | - Be sure to put `DATE` values in quotes with the format: `'YYYY-MM-DD'` 1481 | - You previously used `INSERT INTO more_info(birthday, height, weight, character_id) VALUES('1981-07-09', 155, 64.5, 1);` 1482 | - Try `INSERT INTO more_info(birthday, height, weight, character_id) VALUES('1983-07-14', 175, 48.8, 2);` 1483 | - Or, enter the above command and replace the `2` with the correct `character_id` 1484 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1485 | 1486 | ## 1060. View `more_info` Data 1487 | 1488 | ### 1060.1 1489 | 1490 | View all the data in `more_info` to see more info for Luigi. 1491 | 1492 | #### HINTS 1493 | 1494 | - Use the `SELECT` and `FROM` keywords 1495 | - Here's an example: `SELECT columns FROM table_name;` 1496 | - Use `*` to see all columns 1497 | - Try entering `SELECT * FROM more_info;` 1498 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1499 | 1500 | ## 1070. Select `character_id` and `name` 1501 | 1502 | ### 1070.1 1503 | 1504 | Peach is next. View the `character_id` and `name` columns from the `characters` table again so you can find her id. 1505 | 1506 | #### HINTS 1507 | 1508 | - Use the `SELECT` and `FROM` keywords 1509 | - Here's an example: `SELECT column1, column2 FROM table_name;` 1510 | - Try entering `SELECT character_id, name FROM characters;` 1511 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1512 | 1513 | ## 1080. Add `more_info` for Peach 1514 | 1515 | ### 1080.1 1516 | 1517 | Here's the additional info for Peach: 1518 | 1519 | | birthday | height | weight | 1520 | | ---------- | ------ | ------ | 1521 | | 1985-10-18 | 173 | 52.2 | 1522 | 1523 | Add a row for Peach using the above info. Be sure to add her `character_id` as well. 1524 | 1525 | #### HINTS 1526 | 1527 | - Be sure to put `DATE` values in quotes with the format: `'YYYY-MM-DD'` 1528 | - You previously used `INSERT INTO more_info(birthday, height, weight, character_id) VALUES('1983-07-14', 175, 48.8, 2);` 1529 | - Try `INSERT INTO more_info(birthday, height, weight, character_id) VALUES('1985-10-18', 173, 52.2, 3);` 1530 | - Or, enter the above command and replace the `3` with the correct `character_id` 1531 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1532 | 1533 | ## 1090. Select Toad's `character_id` and `name` 1534 | 1535 | ### 1090.1 1536 | 1537 | Toad is next. Instead of viewing all the rows to find his id, you can just view his row with a `WHERE` condition. You used several earlier to delete and update rows. You can use it to view rows as well. Here's an example: 1538 | 1539 | ```sql 1540 | SELECT columns FROM table_name WHERE condition; 1541 | ``` 1542 | 1543 | A condition you used before was `username='Samus'`. Find Toad's id by viewing the `character_id` and `name` columns from `characters` for only his row. 1544 | 1545 | #### HINTS 1546 | 1547 | - Don't forget the semi-colon :smile: 1548 | - Use `name='Toad'` for the condition 1549 | - Try entering `SELECT character_id, name FROM characters WHERE name='Toad';` 1550 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1551 | 1552 | ## 1100. Add `more_info` for Toad 1553 | 1554 | ### 1100.1 1555 | 1556 | Here's what Toad's info looks like: 1557 | 1558 | | birthday | height | weight | 1559 | | ---------- | ------ | ------ | 1560 | | 1950-01-10 | 66 | 35.6 | 1561 | 1562 | Add the above info for Toad. Be sure to add his `character_id`. 1563 | 1564 | #### HINTS 1565 | 1566 | - Put `DATE` values in quotes 1567 | - You previously used `INSERT INTO more_info(birthday, height, weight, character_id) VALUES('1985-10-18', 173, 52.2, 3);` 1568 | - Try `INSERT INTO more_info(birthday, height, weight, character_id) VALUES('1950-01-10', 66, 35.6, 4);` 1569 | - Or, enter the above command and replace the `4` with the correct `character_id` 1570 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1571 | 1572 | ## 1110. View `more_info` Data 1573 | 1574 | ### 1110.1 1575 | 1576 | View all the data in `more_info` to see the rows you added. 1577 | 1578 | #### HINTS 1579 | 1580 | - Use the `SELECT` and `FROM` keywords 1581 | - Here's an example: `SELECT columns FROM table_name;` 1582 | - Use `*` to see all columns 1583 | - Try entering `SELECT * FROM more_info;` 1584 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1585 | 1586 | ## 1120. Select Bowser's Row 1587 | 1588 | ### 1120.1 1589 | 1590 | Bowser is next. Find his id by viewing the `character_id` and `name` columns for only his row. 1591 | 1592 | #### HINTS 1593 | 1594 | - Use the `SELECT`, `FROM`, and `WHERE` keywords 1595 | - Here's an example: `SELECT columns FROM table_name WHERE condition;` 1596 | - I recommend `name='Bowser'` as the condition 1597 | - Try entering `SELECT character_id, name FROM characters WHERE name='Bowser';` 1598 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1599 | 1600 | ## 1130. Add `more_info` for Bowser 1601 | 1602 | ### 1130.1 1603 | 1604 | Here's what Bowser's info looks like: 1605 | 1606 | | birthday | height | weight | 1607 | | ---------- | ------ | ------ | 1608 | | 1990-10-29 | 258 | 300 | 1609 | 1610 | Add the above info for Bowser. Don't forget to add his `character_id`. 1611 | 1612 | #### HINTS 1613 | 1614 | - Be sure to put `DATE` values in quotes with the format: `'YYYY-MM-DD'` 1615 | - You previously used `INSERT INTO more_info(birthday, height, weight, character_id) VALUES('1950-01-10', 66, 35.6, 4);` 1616 | - Try `INSERT INTO more_info(birthday, height, weight, character_id) VALUES('1990-10-29', 258, 300, 5);` 1617 | - Or, enter the above command and replace the `5` with the correct `character_id` 1618 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1619 | 1620 | ## 1140. Select Daisy's Row 1621 | 1622 | ### 1140.1 1623 | 1624 | Daisy is next. Find her id by viewing the `character_id` and `name` columns for only her row. 1625 | 1626 | #### HINTS 1627 | 1628 | - Use the `SELECT`, `FROM`, and `WHERE` keywords 1629 | - Here's an example: `SELECT columns FROM table_name WHERE condition;` 1630 | - Use `name='Daisy'` as the condition 1631 | - Try entering `SELECT character_id, name FROM characters WHERE name='Daisy';` 1632 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1633 | 1634 | ## 1150. Add `more_info` for Daisy 1635 | 1636 | ### 1150.1 1637 | 1638 | The info for Daisy looks like this: 1639 | 1640 | | birthday | height | weight | 1641 | | ---------- | ------ | ------ | 1642 | | 1989-07-31 | NULL | NULL | 1643 | 1644 | Add the above info for Daisy to `more_info`. Be sure to add her `character_id` as well. You can use `NULL` or simply not include the null columns when inserting. 1645 | 1646 | #### HINTS 1647 | 1648 | - You previously used `INSERT INTO more_info(birthday, height, weight, character_id) VALUES('1990-10-29', 173, 300, 5);` 1649 | - Try `INSERT INTO more_info(birthday, height, weight, character_id) VALUES('1989-07-31', NULL, NULL, 6);` 1650 | - Or, enter the above command and replace the `6` with the correct `character_id` 1651 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1652 | 1653 | ## 1160. View `more_info` Data 1654 | 1655 | ### 1160.1 1656 | 1657 | View all the data in `more_info` to see the rows you added. 1658 | 1659 | #### HINTS 1660 | 1661 | - Use the `SELECT` and `FROM` keywords 1662 | - Here's an example: `SELECT columns FROM table_name;` 1663 | - Use `*` to see all columns 1664 | - Try entering `SELECT * FROM more_info;` 1665 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1666 | 1667 | ## 1170. Select Yoshi's `character_id` and `name` 1668 | 1669 | ### 1170.1 1670 | 1671 | Null values show up as blank. Yoshi is last. Find his id by viewing the `character_id` and `name` columns for only his row. 1672 | 1673 | #### HINTS 1674 | 1675 | - Use the `SELECT`, `FROM` and `WHERE` keywords 1676 | - Here's an example: `SELECT columns FROM table_name WHERE condition;` 1677 | - Try entering `SELECT character_id, name FROM characters WHERE name='Yoshi';` 1678 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1679 | 1680 | ## 1180. Add `more_info` for Yoshi 1681 | 1682 | ### 1180.1 1683 | 1684 | The info for Yoshi looks like this: 1685 | 1686 | | birthday | height | weight | 1687 | | ---------- | ------ | ------ | 1688 | | 1990-04-13 | 162 | 59.1 | 1689 | 1690 | Add the above info for Yoshi to `more_info`. Be sure to include his `character_id`. 1691 | 1692 | #### HINTS 1693 | 1694 | - You got this one! 1695 | - You previously used `INSERT INTO more_info(birthday, height, weight, character_id) VALUES('1989-07-31', NULL, NULL, 6);` 1696 | - Try `INSERT INTO more_info(birthday, height, weight, character_id) VALUES('1990-04-13', 162, 59.1, 7);` 1697 | - Or, enter the above command and replace the `7` with the correct `character_id` 1698 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1699 | 1700 | ## 1190. View all `more_info` Data 1701 | 1702 | ### 1190.1 1703 | 1704 | There should be a lot of data in `more_info` now. Take a look at **all** the rows and columns in it. 1705 | 1706 | #### HINTS 1707 | 1708 | - Use the `SELECT` and `FROM` keywords 1709 | - Here's an example: `SELECT columns FROM table_name;` 1710 | - Try `SELECT * FROM more_info;` 1711 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1712 | 1713 | ## 1200. Rename `height` Column 1714 | 1715 | ### 1200.1 1716 | 1717 | It looks good. There is something you can do to help out though. What units do the `height` and `weight` columns use? It's centimeters and kilograms, but nobody will know. Rename the `height` column to `height_in_cm`. 1718 | 1719 | #### HINTS 1720 | 1721 | - Use the `ALTER TABLE`, `RENAME COLUMN` and `TO` keywords 1722 | - Here's an example: `ALTER TABLE table_name RENAME COLUMN column_name TO new_name;` 1723 | - Try `ALTER TABLE more_info RENAME COLUMN height TO height_in_cm;` 1724 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1725 | 1726 | ## 1210. Rename `weight` Column 1727 | 1728 | ### 1210.1 1729 | 1730 | Rename the `weight` column to `weight_in_kg`. 1731 | 1732 | #### HINTS 1733 | 1734 | - Use the `ALTER TABLE`, `RENAME COLUMN` and `TO` keywords 1735 | - Here's an example: `ALTER TABLE table_name RENAME COLUMN column_name TO new_name;` 1736 | - Try `ALTER TABLE more_info RENAME COLUMN weight TO weight_in_kg;` 1737 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1738 | 1739 | ## 1230. View all `more_info` Data 1740 | 1741 | ### 1230.1 1742 | 1743 | Take a quick look at all the data in `more_info` to see the new column names. 1744 | 1745 | #### HINTS 1746 | 1747 | - Use the `SELECT` and `FROM` keywords 1748 | - Here's an example: `SELECT columns FROM table_name;` 1749 | - Try `SELECT * FROM more_info;` 1750 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1751 | 1752 | ## 1240. Create `sounds` Table 1753 | 1754 | ### 1240.1 1755 | 1756 | Next, you will make a `sounds` table that holds filenames of sounds the characters make. You created your other tables similar to this: 1757 | 1758 | ```sql 1759 | CREATE TABLE table_name(); 1760 | ``` 1761 | 1762 | Inside those parenthesis you can put columns for a table so you don't need to add them with a separate command, like this: 1763 | 1764 | ```sql 1765 | CREATE TABLE table_name(column_name DATATYPE CONSTRAINTS); 1766 | ``` 1767 | 1768 | Create a new table named `sounds`. Give it a column named `sound_id` of type `SERIAL` and a constraint of `PRIMARY KEY`. 1769 | 1770 | #### HINTS 1771 | 1772 | - Try entering `CREATE TABLE sounds(sound_id SERIAL PRIMARY KEY);` 1773 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1774 | 1775 | ## 1260. View `mario_database` Tables 1776 | 1777 | ### 1260.1 1778 | 1779 | View the tables in `mario_database` to make sure it worked. 1780 | 1781 | #### HINTS 1782 | 1783 | - Use the **d**isplay shortcut command 1784 | - Try entering `\d` 1785 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1786 | 1787 | ## 1270. Add `filename` Column 1788 | 1789 | ### 1270.1 1790 | 1791 | There's your `sounds` table. Add a column to it named `filename`. Make it a `VARCHAR` that has a max length of `40` and with constraints of `NOT NULL` and `UNIQUE`. You can put those constraints at the end of the query to add them all. 1792 | 1793 | #### HINTS 1794 | 1795 | - Use the `ALTER TABLE` and `ADD COLUMN` keywords 1796 | - Give it three properties: `VARCHAR(40) NOT NULL UNIQUE` 1797 | - Here's an example: `ALTER TABLE table_name ADD COLUMN column_name DATATYPE CONSTRAINTS;` 1798 | - Try entering `ALTER TABLE sounds ADD COLUMN filename VARCHAR(40) NOT NULL UNIQUE;` 1799 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1800 | 1801 | ## 1280. Add `sounds` Foreign Key 1802 | 1803 | ### 1280.1 1804 | 1805 | You want to use `character_id` as a foreign key again. This will be a "one-to-many" relationship because **one** character will have **many** sounds, but no sound will have more than one character. Here's the example again: 1806 | 1807 | ```sql 1808 | ALTER TABLE table_name ADD COLUMN column_name DATATYPE CONSTRAINT REFERENCES referenced_table_name(referenced_column_name); 1809 | ``` 1810 | 1811 | Add a column to `sounds` named `character_id`. Give it the properties `INT`, `NOT NULL`, and set it as a foreign key that references `character_id` from `characters`. 1812 | 1813 | #### HINTS 1814 | 1815 | - You can do this! 1816 | - Give it one more try, take a close look at all those values and keywords 1817 | - Without the keywords, it looks like this: `sounds character_id characters(character_id);` 1818 | - Try using `ALTER TABLE sounds ADD COLUMN character_id INT NOT NULL REFERENCES characters(character_id);` 1819 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1820 | 1821 | ## 1290. View `sounds` Details 1822 | 1823 | ### 1290.1 1824 | 1825 | Take a look at the details of the `sounds` table to see all the columns. 1826 | 1827 | #### HINTS 1828 | 1829 | - Use the **d**isplay shortcut command 1830 | - Here's an example: `\d table_name` 1831 | - Try entering `\d sounds` 1832 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1833 | 1834 | ## 1300. View `characters` Data 1835 | 1836 | ### 1300.1 1837 | 1838 | Next, you will add some rows. But first, view all the data in `characters` so you can find the correct id's again. **Order** them **by** `character_id` like you did earlier. 1839 | 1840 | #### HINTS 1841 | 1842 | - Use the `SELECT` and `FROM` keywords 1843 | - Here's an example: `SELECT columns FROM table_name ORDER BY column;` 1844 | - Use `*` to select all the columns 1845 | - Try entering `SELECT * FROM characters ORDER BY character_id;` 1846 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1847 | 1848 | ## 1310. Insert `its-a-me.wav` 1849 | 1850 | ### 1310.1 1851 | 1852 | The first file is named `its-a-me.wav`. Insert it into the `sounds` table with Mario's id as the `character_id`. 1853 | 1854 | #### HINTS 1855 | 1856 | - Don't for get the quotes 1857 | - Use `INSERT INTO` and `VALUES` keywords 1858 | - Here's an example: `INSERT INTO table_name(column_1, column_2) VALUES(value_1, value_2);` 1859 | - Try `INSERT INTO sounds(filename, character_id) VALUES('its-a-me.wav', 1);` 1860 | - Or, enter the above command and replace the `1` with the correct `character_id` 1861 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1862 | 1863 | ## 1320. Insert `yippee.wav` 1864 | 1865 | ### 1320.1 1866 | 1867 | Add another row with a `filename` of `yippee.wav`. Use Mario's `character_id` again for the foreign key value. 1868 | 1869 | #### HINTS 1870 | 1871 | - Don't forget the quotes 1872 | - You previously used: `INSERT INTO sounds(filename, character_id) VALUES('its-a-me.wav', 1);` 1873 | - Try entering `INSERT INTO sounds(filename, character_id) VALUES('yippee.wav', 1);` 1874 | - Or, enter the above command and replace the `1` with the correct `character_id` 1875 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1876 | 1877 | ## 1330. Insert `ha-ha.wav` 1878 | 1879 | ### 1330.1 1880 | 1881 | Add another row to `sounds` for Luigi named `ha-ha.wav`. Use his `character_id` this time. Take a look at the data in `characters` to find his id if you need to. 1882 | 1883 | #### HINTS 1884 | 1885 | - You previously used: `INSERT INTO sounds(filename, character_id) VALUES('its-a-me.wav', 1);` 1886 | - Try entering `INSERT INTO sounds(filename, character_id) VALUES('ha-ha.wav', 2);` 1887 | - Or, enter the above command and replace the `2` with the correct `character_id` 1888 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1889 | 1890 | ## 1340. Insert `oh-yeah.wav` 1891 | 1892 | ### 1340.1 1893 | 1894 | Add another row with a filename of `oh-yeah.wav`. This one is for Luigi as well so use his `character_id` again. 1895 | 1896 | #### HINTS 1897 | 1898 | - Try `INSERT INTO sounds(filename, character_id) VALUES('oh-yeah.wav', 2);` 1899 | - Or, enter the above command and replace the `2` with the correct `character_id` 1900 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1901 | 1902 | ## 1350. Insert Sounds for Peach 1903 | 1904 | ### 1350.1 1905 | 1906 | Add two more rows for Peach sounds. The filenames are `yay.wav` and `woo-hoo.wav`. Don't forget her `character_id`. Try to do it with one command. 1907 | 1908 | #### HINTS 1909 | 1910 | - Here's an example: `INSERT INTO table_name(column_1, column_2) VALUES(value_1, value_2), (value_1, value_2);` 1911 | - Find her `character_id` by viewing data in the `characters` table 1912 | - Try `INSERT INTO sounds(filename, character_id) VALUES('yay.wav', 3), ('woo-hoo.wav', 3);` 1913 | - Or, enter the above command and replace the `3` with the correct `character_id` 1914 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1915 | 1916 | ## 1360. Insert Two More Sounds 1917 | 1918 | ### 1360.1 1919 | 1920 | Add two more rows. The filenames are `mm-hmm.wav` and `yahoo.wav`. The first one is for Peach again, the second is for Mario, so use the correct foreign key values. Try to do it with one command. 1921 | 1922 | #### HINTS 1923 | 1924 | - Here's an example: `INSERT INTO table_name(column_1, column_2) VALUES(value_1, value_2), (value_1, value_2);` 1925 | - Find their `character_id` by viewing data in the `characters` table 1926 | - Try `INSERT INTO sounds(filename, character_id) VALUES('mm-hmm.wav', 3), ('yahoo.wav', 1);` 1927 | - Or, enter the above command and replace the `3` and `1` with the correct `character_id` 1928 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1929 | 1930 | ## 1370. View `sounds` Data 1931 | 1932 | ### 1370.1 1933 | 1934 | View all the data in the `sounds` table. You should be able to see the "one-to-many" relationship better. One character has many sounds. 1935 | 1936 | #### HINTS 1937 | 1938 | - Use the `SELECT` and `FROM` keywords 1939 | - Here's an example: `SELECT columns FROM table_name;` 1940 | - Use `*` to select all the columns 1941 | - Try entering `SELECT * FROM sounds;` 1942 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1943 | 1944 | ## 1380. Create `actions` Table 1945 | 1946 | ### 1380.1 1947 | 1948 | See the "one-to-many" relationship? Create another new table called `actions`. Give it a column named `action_id` that's a type of `SERIAL`, and make it the `PRIMARY KEY`. Try to create the table and add the column with one command. 1949 | 1950 | #### HINTS 1951 | 1952 | - Use `CREATE TABLE`, `SERIAL`, and `PRIMARY KEY` 1953 | - You previously used `CREATE TABLE sounds(sound_id SERIAL PRIMARY KEY);` 1954 | - Try entering `CREATE TABLE actions(action_id SERIAL PRIMARY KEY);` 1955 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1956 | 1957 | ## 1390. Add `action` Column 1958 | 1959 | ### 1390.1 1960 | 1961 | Add a column named `action` to your new table. Give it a type of `VARCHAR` that is a max length of `20` and has `UNIQUE` and `NOT NULL` constraints. 1962 | 1963 | #### HINTS 1964 | 1965 | - Use the `ALTER TABLE` and `ADD COLUMN` keywords 1966 | - You previously used `ALTER TABLE sounds ADD COLUMN filename VARCHAR(40) NOT NULL UNIQUE;` 1967 | - Try entering `ALTER TABLE actions ADD COLUMN action VARCHAR(20) UNIQUE NOT NULL;` 1968 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1969 | 1970 | ## 1400. Insert `run` 1971 | 1972 | ### 1400.1 1973 | 1974 | The actions table won't have any foreign keys. It's going to have a "many-to-many" relationship with the characters table. This is because **many** of the characters can perform **many** actions. You will see why you don't need a foreign key later. Insert a row into the `actions` table. Give it an `action` of `run`. 1975 | 1976 | #### HINTS 1977 | 1978 | - Use the `INSERT INTO` and `VALUES` keywords 1979 | - Don't forget the single quotes 1980 | - Here's an example `INSERT INTO table(column) VALUES(value);` 1981 | - Try entering `INSERT INTO actions(action) VALUES('run');` 1982 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1983 | 1984 | ## 1410. Insert `jump` 1985 | 1986 | ### 1410.1 1987 | 1988 | Insert another row into the `actions` table. Give it an `action` of `jump`. 1989 | 1990 | #### HINTS 1991 | 1992 | - Use the `INSERT INTO` and `VALUES` keywords 1993 | - Don't forget the single quotes 1994 | - You previously used `INSERT INTO actions(action) VALUES('run');` 1995 | - Try entering `INSERT INTO actions(action) VALUES('jump');` 1996 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 1997 | 1998 | ## 1420. Insert `duck` 1999 | 2000 | ### 1420.1 2001 | 2002 | Add another action row with an `action` of `duck`. 2003 | 2004 | #### HINTS 2005 | 2006 | - Use the `INSERT INTO` and `VALUES` keywords 2007 | - Don't forget the single quotes 2008 | - You previously used `INSERT INTO actions(action) VALUES('jump');` 2009 | - Try entering `INSERT INTO actions(action) VALUES('duck');` 2010 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2011 | 2012 | ## 1430. View `actions` Data 2013 | 2014 | ### 1430.1 2015 | 2016 | View all the data in `actions` to make sure there's no mistakes. 2017 | 2018 | #### HINTS 2019 | 2020 | - Use the `SELECT` and `FROM` keywords 2021 | - Here's an example: `SELECT columns FROM table_name;` 2022 | - Use `*` to select all the columns 2023 | - Try entering `SELECT * FROM actions;` 2024 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2025 | 2026 | ## 1440. Create Junction Table 2027 | 2028 | ### 1440.1 2029 | 2030 | It looks good. "Many-to-many" relationships usually use a **junction** table to link two tables together, forming two "one-to-many" relationships. Your `characters` and `actions` table will be linked using a junction table. Create a new table called `character_actions`. It will describe what actions each character can perform. 2031 | 2032 | #### HINTS 2033 | 2034 | - Use the `CREATE TABLE` keywords 2035 | - You previously used `CREATE TABLE more_info();` 2036 | - Try entering `CREATE TABLE character_actions();` 2037 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2038 | 2039 | ## 1450. Add `character_id` Column 2040 | 2041 | ### 1450.1 2042 | 2043 | Your junction table will use the primary keys from the `characters` and `actions` tables as foreign keys to create the relationship. Add a column named `character_id` to your junction table. Give it the type of `INT` and constraint of `NOT NULL`. 2044 | 2045 | #### HINTS 2046 | 2047 | - Use the `ALTER TABLE` and `ADD COLUMN` keywords 2048 | - You previously used: `ALTER TABLE actions ADD COLUMN name VARCHAR(20) UNIQUE NOT NULL;` 2049 | - Try entering `ALTER TABLE character_actions ADD COLUMN character_id INT NOT NULL;` 2050 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2051 | 2052 | ## 1460. Add `character_id` as Foreign Key 2053 | 2054 | ### 1460.1 2055 | 2056 | The foreign keys you set before were added when you created the column. You can set an existing column as a foreign key like this: 2057 | 2058 | ```sql 2059 | ALTER TABLE table_name ADD FOREIGN KEY(column_name) REFERENCES referenced_table(referenced_column); 2060 | ``` 2061 | 2062 | Set the `character_id` column you just added as a foreign key that references the `character_id` from the `characters` table. 2063 | 2064 | #### HINTS 2065 | 2066 | - Without the keywords, it looks like this: `character_actions character_id characters(character_id);` 2067 | - All the info you need is there, read it closely 2068 | - Try this: `ALTER TABLE character_actions ADD FOREIGN KEY(character_id) REFERENCES characters(character_id);` 2069 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2070 | 2071 | ## 1470. View `character_actions` Details 2072 | 2073 | ### 1470.1 2074 | 2075 | View the details of the `character_actions` table to see the foreign key you added. 2076 | 2077 | #### HINTS 2078 | 2079 | - Use the **d**isplay command 2080 | - Add the table name after the command 2081 | - Enter `\d character_actions` 2082 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2083 | 2084 | ## 1480. Add `action_id` Column 2085 | 2086 | ### 1480.1 2087 | 2088 | Add another column to `character_actions` named `action_id`. Give it a type of `INT` and constraint of `NOT NULL`. 2089 | 2090 | #### HINTS 2091 | 2092 | - Use the `ALTER TABLE` and `ADD COLUMN` keywords 2093 | - You previously used: `ALTER TABLE character_actions ADD COLUMN character_id INT NOT NULL;` 2094 | - Try entering `ALTER TABLE character_actions ADD COLUMN action_id INT NOT NULL;` 2095 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2096 | 2097 | ## 1500. Add `action_id` as Foreign Key 2098 | 2099 | ### 1500.1 2100 | 2101 | This will be a foreign key as well. Set the `action_id` column you just added as a foreign key that references the `action_id` column from the `actions` table. 2102 | 2103 | #### HINTS 2104 | 2105 | - Here's the example again: `ALTER TABLE table_name ADD FOREIGN KEY(column_name) REFERENCES referenced_table(referenced_column);` 2106 | - Without the keywords, it looks like this: `character_actions action_id actions(action_id);` 2107 | - You previously used: `ALTER TABLE characters_actions ADD FOREIGN KEY(character_id) REFERENCES characters(character_id);` 2108 | - Here it is `ALTER TABLE character_actions ADD FOREIGN KEY(action_id) REFERENCES actions(action_id);` 2109 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2110 | 2111 | ## 1510. View `character_actions` Details 2112 | 2113 | ### 1510.1 2114 | 2115 | View the details of the `character_actions` table to see your keys. 2116 | 2117 | #### HINTS 2118 | 2119 | - Use the **d**isplay command 2120 | - Add the table name after the command 2121 | - Enter `\d character_actions` 2122 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2123 | 2124 | ## 1520. Create Composite Primary Key 2125 | 2126 | ### 1520.1 2127 | 2128 | Every table should have a primary key. Your previous tables had a single column as a primary key. This one will be different. You can create a primary key from two columns, known as a **composite** primary key. Here's an example: 2129 | 2130 | ```sql 2131 | ALTER TABLE table_name ADD PRIMARY KEY(column1, column2); 2132 | ``` 2133 | 2134 | Use `character_id` and `action_id` to create a composite primary key for this table. 2135 | 2136 | #### HINTS 2137 | 2138 | - Try `ALTER TABLE character_actions ADD PRIMARY KEY(character_id, action_id);` 2139 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2140 | 2141 | ## 1530. View `character_actions` Details 2142 | 2143 | ### 1530.1 2144 | 2145 | This table will have multiple rows with the same `character_id`, and multiple rows the same `action_id`. So neither of them are unique. But you will never have the same `character_id` and `action_id` in a single row. So the two columns together can be used to uniquely identify each row. View the details of the `character_actions` table to see your composite key. 2146 | 2147 | #### HINTS 2148 | 2149 | - Use the **d**isplay command 2150 | - Add the table name after the command 2151 | - Enter `\d character_actions` 2152 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2153 | 2154 | ## 1540. Insert Yoshi Actions 2155 | 2156 | ### 1540.1 2157 | 2158 | Insert three rows into `character_actions` for all the actions Yoshi can perform. He can perform all of them in the `actions` table. View the data in the `characters` and `actions` table to find the correct id's for the information. 2159 | 2160 | #### HINTS 2161 | 2162 | - Use the `INSERT INTO` and `VALUES` keywords 2163 | - Here's an example: `INSERT INTO table_name(column_1, column_2) VALUES(value_1, value_2), (value_1, value_2);` 2164 | - Try `INSERT INTO character_actions(character_id, action_id) VALUES(7, 1), (7, 2), (7, 3);` 2165 | - Or, enter the above command and use the correct id's 2166 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2167 | 2168 | ## 1550. View `character_actions` Data 2169 | 2170 | ### 1550.1 2171 | 2172 | View all the data in `character_actions` to see your rows. 2173 | 2174 | #### HINTS 2175 | 2176 | - Use the `SELECT` and `FROM` keywords 2177 | - Here's an example: `SELECT columns FROM table_name;` 2178 | - Use `*` to select all the columns 2179 | - Try entering `SELECT * FROM character_actions;` 2180 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2181 | 2182 | ## 1560. Insert Daisy Actions 2183 | 2184 | ### 1560.1 2185 | 2186 | Add three more rows into `character_actions` for all of Daisy's actions. She can perform all of the actions, as well. 2187 | 2188 | #### HINTS 2189 | 2190 | - View the data in the `characters` and `actions` table to find the correct id's for the information. 2191 | - Use the `INSERT INTO` and `VALUES` keywords 2192 | - Here's an example: `INSERT INTO table_name(column_1, column_2) VALUES(value_1, value_2), (value_1, value_2);` 2193 | - You previously used `INSERT INTO character_actions(character_id, action_id) VALUES(7, 1), (7, 2), (7, 3);` 2194 | - Try `INSERT INTO character_actions(character_id, action_id) VALUES(6, 1), (6, 2), (6, 3);` 2195 | - Or, enter the above command and use the correct id's 2196 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2197 | 2198 | ## 1570. Insert Bowser Actions 2199 | 2200 | ### 1570.1 2201 | 2202 | Bowser can perform all the actions. Add three rows to the table for him. 2203 | 2204 | #### HINTS 2205 | 2206 | - View the data in the `characters` and `actions` table to find the correct id's for the information. 2207 | - Use the `INSERT INTO` and `VALUES` keywords 2208 | - Use `1`, `2`, and `3` for the `action_id` values 2209 | - Here's an example: `INSERT INTO table_name(column_1, column_2) VALUES(value_1, value_2), (value_1, value_2);` 2210 | - You previously used `INSERT INTO character_actions(character_id, action_id) VALUES(6, 1), (6, 2), (6, 3);` 2211 | - Try `INSERT INTO character_actions(character_id, action_id) VALUES(5, 1), (5, 2), (5, 3);` 2212 | - Or, enter the above command and use the correct id's 2213 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2214 | 2215 | ## 1580. Insert Toad Actions 2216 | 2217 | ### 1580.1 2218 | 2219 | Next is Toad. Add three more rows for his actions. 2220 | 2221 | #### HINTS 2222 | 2223 | - Add a row into `character_actions` for each action `Toad` can perform 2224 | - View the data in the `characters` and `actions` table to find the correct id's for the information. 2225 | - Use the `INSERT INTO` and `VALUES` keywords 2226 | - Here's an example: `INSERT INTO table_name(column_1, column_2) VALUES(value_1, value_2), (value_1, value_2);` 2227 | - You previously used `INSERT INTO character_actions(character_id, action_id) VALUES(5, 1), (5, 2), (5, 3)` 2228 | - Try `INSERT INTO character_actions(character_id, action_id) VALUES(4, 1), (4, 2), (4, 3);` 2229 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2230 | 2231 | ## 1590. Insert Peach Actions 2232 | 2233 | ### 1590.1 2234 | 2235 | You guessed it. Peach can perform all the actions as well, so add three more rows for her. 2236 | 2237 | #### HINTS 2238 | 2239 | - Add a row into `character_actions` for each action `Peach` can perform 2240 | - View the data in the `characters` and `actions` table to find the correct id's for the information. 2241 | - Here's an example: `INSERT INTO table_name(column_1, column_2) VALUES(value_1, value_2), (value_1, value_2);` 2242 | - You previously used `INSERT INTO character_actions(character_id, action_id) VALUES(4, 1), (4, 2), (4, 3)` 2243 | - Try `INSERT INTO character_actions(character_id, action_id) VALUES(3, 1), (3, 2), (3, 3);` 2244 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2245 | 2246 | ## 1600. Insert Luigi Actions 2247 | 2248 | ### 1600.1 2249 | 2250 | Add three more rows for Luigi's actions. 2251 | 2252 | #### HINTS 2253 | 2254 | - Add a row into `character_actions` for each action `Luigi` can perform 2255 | - He can perform all the actions 2256 | - View the data in the `characters` and `actions` table to find the correct id's for the information. 2257 | - Use the `INSERT INTO` and `VALUES` keywords 2258 | - Here's an example: `INSERT INTO table_name(column_1, column_2) VALUES(value_1, value_2), (value_1, value_2);` 2259 | - You previously used `INSERT INTO character_actions(character_id, action_id) VALUES(3, 1), (3, 2), (3, 3)` 2260 | - Try `INSERT INTO character_actions(character_id, action_id) VALUES(2, 1), (2, 2), (2, 3);` 2261 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2262 | 2263 | ## 1610. Insert Mario Actions 2264 | 2265 | ### 1610.1 2266 | 2267 | Last is Mario, add three rows for his actions. 2268 | 2269 | #### HINTS 2270 | 2271 | - Add a row into `character_actions` for each action `Mario` can perform 2272 | - View the data in the `characters` and `actions` table to find the correct id's for the information. 2273 | - Here's an example: `INSERT INTO table_name(column_1, column_2) VALUES(value_1, value_2), (value_1, value_2);` 2274 | - You previously used `INSERT INTO character_actions(character_id, action_id) VALUES(2, 1), (2, 2), (2, 3)` 2275 | - Try `INSERT INTO character_actions(character_id, action_id) VALUES(1, 1), (1, 2), (1, 3);` 2276 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2277 | 2278 | ## 1620. View `character_actions` Data 2279 | 2280 | ### 1620.1 2281 | 2282 | That was a lot of work. View all the data in `character_actions` to see the rows you ended up with. 2283 | 2284 | #### HINTS 2285 | 2286 | - Use the `SELECT` and `FROM` keywords 2287 | - Here's an example: `SELECT columns FROM table_name;` 2288 | - Use `*` to select all the columns 2289 | - Try entering `SELECT * FROM character_actions;` 2290 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2291 | 2292 | ## 1630. Display Tables 2293 | 2294 | ### 1630.1 2295 | 2296 | Well done. The database is complete for now. Take a look around to see what you ended up with. First, display all the tables you created. 2297 | 2298 | #### HINTS 2299 | 2300 | - Use the **d**isplay command 2301 | - Enter `\d` 2302 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2303 | 2304 | ## 1640. View `characters` Data 2305 | 2306 | ### 1640.1 2307 | 2308 | There's five tables there. Nice job. Next, take a look at all the data in the `characters` table. 2309 | 2310 | #### HINTS 2311 | 2312 | - Use the `SELECT` and `FROM` keywords 2313 | - Here's an example: `SELECT columns FROM table_name;` 2314 | - Use `*` to select all the columns 2315 | - Try entering `SELECT * FROM characters;` 2316 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2317 | 2318 | ## 1650. View `more_info` Data 2319 | 2320 | ### 1650.1 2321 | 2322 | Those are some lovely characters. View all the data in the `more_info` table. 2323 | 2324 | #### HINTS 2325 | 2326 | - Use the `SELECT` and `FROM` keywords 2327 | - Here's an example: `SELECT columns FROM table_name;` 2328 | - Use `*` to select all the columns 2329 | - Try entering `SELECT * FROM more_info;` 2330 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2331 | 2332 | ## 1660. Full Join `characters` on `more_info` 2333 | 2334 | ### 1660.1 2335 | 2336 | You can see the `character_id` there so you just need to find the matching id in the `characters` table to find out who it's for. Or... You added that as a foreign key, that means you can get all the data from both tables with a `JOIN` command: 2337 | 2338 | ```sql 2339 | SELECT columns FROM table_1 FULL JOIN table_2 ON table_1.primary_key_column = table_2.foreign_key_column; 2340 | ``` 2341 | 2342 | Enter a join command to see **all** the info from both tables. The two tables are `characters` and `more_info`. The columns are the `character_id` column from both tables since those are the linked keys. 2343 | 2344 | #### HINTS 2345 | 2346 | - Use `*` to see all the columns 2347 | - Give it one more try, read closely 2348 | - Without the keywords, it looks like this: `characters more_info characters.character_id = more_info.character_id` 2349 | - Try entering `SELECT * FROM characters FULL JOIN more_info ON characters.character_id = more_info.character_id;` 2350 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2351 | 2352 | ## 1670. Full Join `characters` on `sounds` 2353 | 2354 | ### 1670.1 2355 | 2356 | Now you can see all the info from both tables. If you recall, that's a "one-to-one" relationship. So there's one row in each table that matches a row from the other. Use another `JOIN` command to view the `characters` and `sounds` tables together. They both use the `character_id` column for their keys as well. 2357 | 2358 | #### HINTS 2359 | 2360 | - Here's the example again: `SELECT columns FROM table_1 FULL JOIN table_2 ON table_1.primary_key_column = table_2.foreign_key_column;` 2361 | - Use `*` to see all the columns 2362 | - You previously used `SELECT * FROM characters FULL JOIN more_info ON characters.character_id = more_info.character_id;` 2363 | - Try entering `SELECT * FROM characters FULL JOIN sounds ON characters.character_id = sounds.character_id;` 2364 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2365 | 2366 | ## 1680. Join `character_actions` with `characters` and `actions` 2367 | 2368 | ### 1680.1 2369 | 2370 | This shows the "one-to-many" relationship. You can see that some of the characters have more than one row because they have **many** sounds. How can you see all the info from the `characters`, `actions`, and `character_actions` tables? Here's an example that joins three tables: 2371 | 2372 | ```sql 2373 | SELECT columns FROM junction_table 2374 | FULL JOIN table_1 ON junction_table.foreign_key_column = table_1.primary_key_column 2375 | FULL JOIN table_2 ON junction_table.foreign_key_column = table_2.primary_key_column; 2376 | ``` 2377 | 2378 | Congratulations on making it this far. This is the last step. View all the data from `characters`, `actions`, and `character_actions` by joining all three tables. When you see the data, be sure to check the "many-to_many" relationship. Many characters will have many actions. 2379 | 2380 | #### HINTS 2381 | 2382 | - Use the `character_id` column to join `character_actions` and `characters` 2383 | - Use the `action_id` column to join `character_actions` and `actions` 2384 | - Without the keywords, it looks like this: `character_actions characters character_actions.character_id = characters.character_id actions character_actions.action_id = actions.action_id;` 2385 | - Try entering `SELECT * FROM character_actions FULL JOIN characters ON character_actions.character_id = characters.character_id FULL JOIN actions ON character_actions.action_id = actions.action_id;` 2386 | - Enter `psql --username=freecodecamp --dbname=mario_database` into the terminal to log in if you aren't already 2387 | - If the tests aren't running automatically, quit psql with `\q` and try logging in again 2388 | -------------------------------------------------------------------------------- /coderoad.yaml: -------------------------------------------------------------------------------- 1 | id: 'freeCodeCamp/learn-relational-databases-by-building-a-mario-database:v1.0.0' 2 | version: '2.0.0' 3 | config: 4 | setup: 5 | commands: 6 | - ./.freeCodeCamp/reset.sh 7 | - cd .freeCodeCamp && npm install 8 | testRunner: 9 | command: npm run programmatic-test 10 | args: 11 | tap: --reporter=mocha-tap-reporter 12 | directory: .freeCodeCamp 13 | repo: 14 | uri: https://github.com/freeCodeCamp/learn-relational-databases-by-building-a-mario-database 15 | branch: v2.0.0 16 | continue: 17 | commands: 18 | - './.freeCodeCamp/reset.sh' 19 | reset: 20 | commands: 21 | - './.freeCodeCamp/reset.sh' 22 | dependencies: 23 | - name: node 24 | version: '>=10' 25 | webhook: 26 | url: 'https://api.freecodecamp.org/coderoad-challenge-completed' 27 | events: 28 | init: false 29 | reset: false 30 | step_complete: false 31 | level_complete: false 32 | tutorial_complete: true 33 | levels: 34 | - id: '10' 35 | steps: 36 | - id: '10.1' 37 | setup: 38 | watchers: 39 | - ../.bash_history 40 | - id: '20' 41 | steps: 42 | - id: '20.1' 43 | setup: 44 | watchers: 45 | - ../pg.log 46 | - id: '30' 47 | steps: 48 | - id: '30.1' 49 | setup: 50 | watchers: 51 | - ../pg.log 52 | - id: '40' 53 | steps: 54 | - id: '40.1' 55 | setup: 56 | watchers: 57 | - ../queryResults.log 58 | - id: '50' 59 | steps: 60 | - id: '50.1' 61 | setup: 62 | watchers: 63 | - ../pg.log 64 | - id: '60' 65 | steps: 66 | - id: '60.1' 67 | setup: 68 | watchers: 69 | - ../queryResults.log 70 | - id: '70' 71 | steps: 72 | - id: '70.1' 73 | setup: 74 | watchers: 75 | - ../pg.log 76 | - id: '80' 77 | steps: 78 | - id: '80.1' 79 | setup: 80 | watchers: 81 | - ../pg.log 82 | - id: '90' 83 | steps: 84 | - id: '90.1' 85 | setup: 86 | watchers: 87 | - ../pg.log 88 | - id: '100' 89 | steps: 90 | - id: '100.1' 91 | setup: 92 | watchers: 93 | - ../queryResults.log 94 | - id: '110' 95 | steps: 96 | - id: '110.1' 97 | setup: 98 | watchers: 99 | - ../pg.log 100 | - id: '120' 101 | steps: 102 | - id: '120.1' 103 | setup: 104 | watchers: 105 | - ../queryResults.log 106 | - id: '130' 107 | steps: 108 | - id: '130.1' 109 | setup: 110 | watchers: 111 | - ../pg.log 112 | - id: '140' 113 | steps: 114 | - id: '140.1' 115 | setup: 116 | watchers: 117 | - ../queryResults.log 118 | - id: '150' 119 | steps: 120 | - id: '150.1' 121 | setup: 122 | watchers: 123 | - ../queryResults.log 124 | - id: '160' 125 | steps: 126 | - id: '160.1' 127 | setup: 128 | watchers: 129 | - ../queryResults.log 130 | - id: '170' 131 | steps: 132 | - id: '170.1' 133 | setup: 134 | watchers: 135 | - ../queryResults.log 136 | - id: '180' 137 | steps: 138 | - id: '180.1' 139 | setup: 140 | watchers: 141 | - ../queryResults.log 142 | - id: '190' 143 | steps: 144 | - id: '190.1' 145 | setup: 146 | watchers: 147 | - ../queryResults.log 148 | - id: '200' 149 | steps: 150 | - id: '200.1' 151 | setup: 152 | watchers: 153 | - ../queryResults.log 154 | - id: '210' 155 | steps: 156 | - id: '210.1' 157 | setup: 158 | watchers: 159 | - ../queryResults.log 160 | - id: '220' 161 | steps: 162 | - id: '220.1' 163 | setup: 164 | watchers: 165 | - ../queryResults.log 166 | - id: '230' 167 | steps: 168 | - id: '230.1' 169 | setup: 170 | watchers: 171 | - ../queryResults.log 172 | - id: '240' 173 | steps: 174 | - id: '240.1' 175 | setup: 176 | watchers: 177 | - ../queryResults.log 178 | - id: '250' 179 | steps: 180 | - id: '250.1' 181 | setup: 182 | watchers: 183 | - ../queryResults.log 184 | - id: '260' 185 | steps: 186 | - id: '260.1' 187 | setup: 188 | watchers: 189 | - ../queryResults.log 190 | - id: '270' 191 | steps: 192 | - id: '270.1' 193 | setup: 194 | watchers: 195 | - ../queryResults.log 196 | - id: '280' 197 | steps: 198 | - id: '280.1' 199 | setup: 200 | watchers: 201 | - ../queryResults.log 202 | - id: '290' 203 | steps: 204 | - id: '290.1' 205 | setup: 206 | watchers: 207 | - ../pg.log 208 | - id: '300' 209 | steps: 210 | - id: '300.1' 211 | setup: 212 | watchers: 213 | - ../queryResults.log 214 | - id: '310' 215 | steps: 216 | - id: '310.1' 217 | setup: 218 | watchers: 219 | - ../pg.log 220 | - id: '320' 221 | steps: 222 | - id: '320.1' 223 | setup: 224 | watchers: 225 | - ../queryResults.log 226 | - id: '330' 227 | steps: 228 | - id: '330.1' 229 | setup: 230 | watchers: 231 | - ../pg.log 232 | - id: '340' 233 | steps: 234 | - id: '340.1' 235 | setup: 236 | watchers: 237 | - ../queryResults.log 238 | - id: '350' 239 | steps: 240 | - id: '350.1' 241 | setup: 242 | watchers: 243 | - ../pg.log 244 | - id: '360' 245 | steps: 246 | - id: '360.1' 247 | setup: 248 | watchers: 249 | - ../queryResults.log 250 | - id: '370' 251 | steps: 252 | - id: '370.1' 253 | setup: 254 | watchers: 255 | - ../queryResults.log 256 | - id: '380' 257 | steps: 258 | - id: '380.1' 259 | setup: 260 | watchers: 261 | - ../pg.log 262 | - id: '390' 263 | steps: 264 | - id: '390.1' 265 | setup: 266 | watchers: 267 | - ../queryResults.log 268 | - id: '400' 269 | steps: 270 | - id: '400.1' 271 | setup: 272 | watchers: 273 | - ../queryResults.log 274 | - id: '410' 275 | steps: 276 | - id: '410.1' 277 | setup: 278 | watchers: 279 | - ../queryResults.log 280 | - id: '420' 281 | steps: 282 | - id: '420.1' 283 | setup: 284 | watchers: 285 | - ../pg.log 286 | - id: '430' 287 | steps: 288 | - id: '430.1' 289 | setup: 290 | watchers: 291 | - ../queryResults.log 292 | - id: '440' 293 | steps: 294 | - id: '440.1' 295 | setup: 296 | watchers: 297 | - ../queryResults.log 298 | - id: '450' 299 | steps: 300 | - id: '450.1' 301 | setup: 302 | watchers: 303 | - ../pg.log 304 | - id: '460' 305 | steps: 306 | - id: '460.1' 307 | setup: 308 | watchers: 309 | - ../queryResults.log 310 | - id: '470' 311 | steps: 312 | - id: '470.1' 313 | setup: 314 | watchers: 315 | - ../queryResults.log 316 | - id: '480' 317 | steps: 318 | - id: '480.1' 319 | setup: 320 | watchers: 321 | - ../pg.log 322 | - id: '490' 323 | steps: 324 | - id: '490.1' 325 | setup: 326 | watchers: 327 | - ../queryResults.log 328 | - id: '500' 329 | steps: 330 | - id: '500.1' 331 | setup: 332 | watchers: 333 | - ../queryResults.log 334 | - id: '530' 335 | steps: 336 | - id: '530.1' 337 | setup: 338 | watchers: 339 | - ../pg.log 340 | - id: '540' 341 | steps: 342 | - id: '540.1' 343 | setup: 344 | watchers: 345 | - ../queryResults.log 346 | - id: '550' 347 | steps: 348 | - id: '550.1' 349 | setup: 350 | watchers: 351 | - ../queryResults.log 352 | - id: '560' 353 | steps: 354 | - id: '560.1' 355 | setup: 356 | watchers: 357 | - ../queryResults.log 358 | - id: '570' 359 | steps: 360 | - id: '570.1' 361 | setup: 362 | watchers: 363 | - ../queryResults.log 364 | - id: '580' 365 | steps: 366 | - id: '580.1' 367 | setup: 368 | watchers: 369 | - ../queryResults.log 370 | - id: '590' 371 | steps: 372 | - id: '590.1' 373 | setup: 374 | watchers: 375 | - ../queryResults.log 376 | - id: '600' 377 | steps: 378 | - id: '600.1' 379 | setup: 380 | watchers: 381 | - ../queryResults.log 382 | - id: '610' 383 | steps: 384 | - id: '610.1' 385 | setup: 386 | watchers: 387 | - ../queryResults.log 388 | - id: '620' 389 | steps: 390 | - id: '620.1' 391 | setup: 392 | watchers: 393 | - ../queryResults.log 394 | - id: '630' 395 | steps: 396 | - id: '630.1' 397 | setup: 398 | watchers: 399 | - ../queryResults.log 400 | - id: '640' 401 | steps: 402 | - id: '640.1' 403 | setup: 404 | watchers: 405 | - ../queryResults.log 406 | - id: '650' 407 | steps: 408 | - id: '650.1' 409 | setup: 410 | watchers: 411 | - ../queryResults.log 412 | - id: '660' 413 | steps: 414 | - id: '660.1' 415 | setup: 416 | watchers: 417 | - ../queryResults.log 418 | - id: '670' 419 | steps: 420 | - id: '670.1' 421 | setup: 422 | watchers: 423 | - ../queryResults.log 424 | - id: '680' 425 | steps: 426 | - id: '680.1' 427 | setup: 428 | watchers: 429 | - ../queryResults.log 430 | - id: '690' 431 | steps: 432 | - id: '690.1' 433 | setup: 434 | watchers: 435 | - ../queryResults.log 436 | - id: '700' 437 | steps: 438 | - id: '700.1' 439 | setup: 440 | watchers: 441 | - ../queryResults.log 442 | - id: '710' 443 | steps: 444 | - id: '710.1' 445 | setup: 446 | watchers: 447 | - ../queryResults.log 448 | - id: '720' 449 | steps: 450 | - id: '720.1' 451 | setup: 452 | watchers: 453 | - ../queryResults.log 454 | - id: '730' 455 | steps: 456 | - id: '730.1' 457 | setup: 458 | watchers: 459 | - ../queryResults.log 460 | - id: '740' 461 | steps: 462 | - id: '740.1' 463 | setup: 464 | watchers: 465 | - ../queryResults.log 466 | - id: '750' 467 | steps: 468 | - id: '750.1' 469 | setup: 470 | watchers: 471 | - ../queryResults.log 472 | - id: '760' 473 | steps: 474 | - id: '760.1' 475 | setup: 476 | watchers: 477 | - ../queryResults.log 478 | - id: '770' 479 | steps: 480 | - id: '770.1' 481 | setup: 482 | watchers: 483 | - ../queryResults.log 484 | - id: '780' 485 | steps: 486 | - id: '780.1' 487 | setup: 488 | watchers: 489 | - ../queryResults.log 490 | - id: '790' 491 | steps: 492 | - id: '790.1' 493 | setup: 494 | watchers: 495 | - ../queryResults.log 496 | - id: '800' 497 | steps: 498 | - id: '800.1' 499 | setup: 500 | watchers: 501 | - ../queryResults.log 502 | - id: '810' 503 | steps: 504 | - id: '810.1' 505 | setup: 506 | watchers: 507 | - ../queryResults.log 508 | - id: '820' 509 | steps: 510 | - id: '820.1' 511 | setup: 512 | watchers: 513 | - ../queryResults.log 514 | - id: '830' 515 | steps: 516 | - id: '830.1' 517 | setup: 518 | watchers: 519 | - ../queryResults.log 520 | - id: '840' 521 | steps: 522 | - id: '840.1' 523 | setup: 524 | watchers: 525 | - ../queryResults.log 526 | - id: '850' 527 | steps: 528 | - id: '850.1' 529 | setup: 530 | watchers: 531 | - ../queryResults.log 532 | - id: '860' 533 | steps: 534 | - id: '860.1' 535 | setup: 536 | watchers: 537 | - ../queryResults.log 538 | - id: '870' 539 | steps: 540 | - id: '870.1' 541 | setup: 542 | watchers: 543 | - ../queryResults.log 544 | - id: '880' 545 | steps: 546 | - id: '880.1' 547 | setup: 548 | watchers: 549 | - ../queryResults.log 550 | - id: '890' 551 | steps: 552 | - id: '890.1' 553 | setup: 554 | watchers: 555 | - ../queryResults.log 556 | - id: '895' 557 | steps: 558 | - id: '895.1' 559 | setup: 560 | watchers: 561 | - ../queryResults.log 562 | - id: '900' 563 | steps: 564 | - id: '900.1' 565 | setup: 566 | watchers: 567 | - ../queryResults.log 568 | - id: '910' 569 | steps: 570 | - id: '910.1' 571 | setup: 572 | watchers: 573 | - ../queryResults.log 574 | - id: '920' 575 | steps: 576 | - id: '920.1' 577 | setup: 578 | watchers: 579 | - ../queryResults.log 580 | - id: '930' 581 | steps: 582 | - id: '930.1' 583 | setup: 584 | watchers: 585 | - ../queryResults.log 586 | - id: '940' 587 | steps: 588 | - id: '940.1' 589 | setup: 590 | watchers: 591 | - ../queryResults.log 592 | - id: '950' 593 | steps: 594 | - id: '950.1' 595 | setup: 596 | watchers: 597 | - ../queryResults.log 598 | - id: '960' 599 | steps: 600 | - id: '960.1' 601 | setup: 602 | watchers: 603 | - ../queryResults.log 604 | - id: '970' 605 | steps: 606 | - id: '970.1' 607 | setup: 608 | watchers: 609 | - ../queryResults.log 610 | - id: '980' 611 | steps: 612 | - id: '980.1' 613 | setup: 614 | watchers: 615 | - ../queryResults.log 616 | - id: '990' 617 | steps: 618 | - id: '990.1' 619 | setup: 620 | watchers: 621 | - ../queryResults.log 622 | - id: '1000' 623 | steps: 624 | - id: '1000.1' 625 | setup: 626 | watchers: 627 | - ../queryResults.log 628 | - id: '1010' 629 | steps: 630 | - id: '1010.1' 631 | setup: 632 | watchers: 633 | - ../queryResults.log 634 | - id: '1020' 635 | steps: 636 | - id: '1020.1' 637 | setup: 638 | watchers: 639 | - ../queryResults.log 640 | - id: '1030' 641 | steps: 642 | - id: '1030.1' 643 | setup: 644 | watchers: 645 | - ../queryResults.log 646 | - id: '1040' 647 | steps: 648 | - id: '1040.1' 649 | setup: 650 | watchers: 651 | - ../queryResults.log 652 | - id: '1050' 653 | steps: 654 | - id: '1050.1' 655 | setup: 656 | watchers: 657 | - ../queryResults.log 658 | - id: '1060' 659 | steps: 660 | - id: '1060.1' 661 | setup: 662 | watchers: 663 | - ../queryResults.log 664 | - id: '1070' 665 | steps: 666 | - id: '1070.1' 667 | setup: 668 | watchers: 669 | - ../queryResults.log 670 | - id: '1080' 671 | steps: 672 | - id: '1080.1' 673 | setup: 674 | watchers: 675 | - ../queryResults.log 676 | - id: '1090' 677 | steps: 678 | - id: '1090.1' 679 | setup: 680 | watchers: 681 | - ../queryResults.log 682 | - id: '1100' 683 | steps: 684 | - id: '1100.1' 685 | setup: 686 | watchers: 687 | - ../queryResults.log 688 | - id: '1110' 689 | steps: 690 | - id: '1110.1' 691 | setup: 692 | watchers: 693 | - ../queryResults.log 694 | - id: '1120' 695 | steps: 696 | - id: '1120.1' 697 | setup: 698 | watchers: 699 | - ../queryResults.log 700 | - id: '1130' 701 | steps: 702 | - id: '1130.1' 703 | setup: 704 | watchers: 705 | - ../queryResults.log 706 | - id: '1140' 707 | steps: 708 | - id: '1140.1' 709 | setup: 710 | watchers: 711 | - ../queryResults.log 712 | - id: '1150' 713 | steps: 714 | - id: '1150.1' 715 | setup: 716 | watchers: 717 | - ../queryResults.log 718 | - id: '1160' 719 | steps: 720 | - id: '1160.1' 721 | setup: 722 | watchers: 723 | - ../queryResults.log 724 | - id: '1170' 725 | steps: 726 | - id: '1170.1' 727 | setup: 728 | watchers: 729 | - ../queryResults.log 730 | - id: '1180' 731 | steps: 732 | - id: '1180.1' 733 | setup: 734 | watchers: 735 | - ../queryResults.log 736 | - id: '1190' 737 | steps: 738 | - id: '1190.1' 739 | setup: 740 | watchers: 741 | - ../queryResults.log 742 | - id: '1200' 743 | steps: 744 | - id: '1200.1' 745 | setup: 746 | watchers: 747 | - ../queryResults.log 748 | - id: '1210' 749 | steps: 750 | - id: '1210.1' 751 | setup: 752 | watchers: 753 | - ../queryResults.log 754 | - id: '1230' 755 | steps: 756 | - id: '1230.1' 757 | setup: 758 | watchers: 759 | - ../queryResults.log 760 | - id: '1240' 761 | steps: 762 | - id: '1240.1' 763 | setup: 764 | watchers: 765 | - ../queryResults.log 766 | - id: '1260' 767 | steps: 768 | - id: '1260.1' 769 | setup: 770 | watchers: 771 | - ../queryResults.log 772 | - id: '1270' 773 | steps: 774 | - id: '1270.1' 775 | setup: 776 | watchers: 777 | - ../queryResults.log 778 | - id: '1280' 779 | steps: 780 | - id: '1280.1' 781 | setup: 782 | watchers: 783 | - ../queryResults.log 784 | - id: '1290' 785 | steps: 786 | - id: '1290.1' 787 | setup: 788 | watchers: 789 | - ../queryResults.log 790 | - id: '1300' 791 | steps: 792 | - id: '1300.1' 793 | setup: 794 | watchers: 795 | - ../queryResults.log 796 | - id: '1310' 797 | steps: 798 | - id: '1310.1' 799 | setup: 800 | watchers: 801 | - ../queryResults.log 802 | - id: '1320' 803 | steps: 804 | - id: '1320.1' 805 | setup: 806 | watchers: 807 | - ../queryResults.log 808 | - id: '1330' 809 | steps: 810 | - id: '1330.1' 811 | setup: 812 | watchers: 813 | - ../queryResults.log 814 | - id: '1340' 815 | steps: 816 | - id: '1340.1' 817 | setup: 818 | watchers: 819 | - ../queryResults.log 820 | - id: '1350' 821 | steps: 822 | - id: '1350.1' 823 | setup: 824 | watchers: 825 | - ../queryResults.log 826 | - id: '1360' 827 | steps: 828 | - id: '1360.1' 829 | setup: 830 | watchers: 831 | - ../queryResults.log 832 | - id: '1370' 833 | steps: 834 | - id: '1370.1' 835 | setup: 836 | watchers: 837 | - ../queryResults.log 838 | - id: '1380' 839 | steps: 840 | - id: '1380.1' 841 | setup: 842 | watchers: 843 | - ../queryResults.log 844 | - id: '1390' 845 | steps: 846 | - id: '1390.1' 847 | setup: 848 | watchers: 849 | - ../queryResults.log 850 | - id: '1400' 851 | steps: 852 | - id: '1400.1' 853 | setup: 854 | watchers: 855 | - ../queryResults.log 856 | - id: '1410' 857 | steps: 858 | - id: '1410.1' 859 | setup: 860 | watchers: 861 | - ../queryResults.log 862 | - id: '1420' 863 | steps: 864 | - id: '1420.1' 865 | setup: 866 | watchers: 867 | - ../queryResults.log 868 | - id: '1430' 869 | steps: 870 | - id: '1430.1' 871 | setup: 872 | watchers: 873 | - ../queryResults.log 874 | - id: '1440' 875 | steps: 876 | - id: '1440.1' 877 | setup: 878 | watchers: 879 | - ../queryResults.log 880 | - id: '1450' 881 | steps: 882 | - id: '1450.1' 883 | setup: 884 | watchers: 885 | - ../queryResults.log 886 | - id: '1460' 887 | steps: 888 | - id: '1460.1' 889 | setup: 890 | watchers: 891 | - ../queryResults.log 892 | - id: '1470' 893 | steps: 894 | - id: '1470.1' 895 | setup: 896 | watchers: 897 | - ../queryResults.log 898 | - id: '1480' 899 | steps: 900 | - id: '1480.1' 901 | setup: 902 | watchers: 903 | - ../queryResults.log 904 | - id: '1500' 905 | steps: 906 | - id: '1500.1' 907 | setup: 908 | watchers: 909 | - ../queryResults.log 910 | - id: '1510' 911 | steps: 912 | - id: '1510.1' 913 | setup: 914 | watchers: 915 | - ../queryResults.log 916 | - id: '1520' 917 | steps: 918 | - id: '1520.1' 919 | setup: 920 | watchers: 921 | - ../queryResults.log 922 | - id: '1530' 923 | steps: 924 | - id: '1530.1' 925 | setup: 926 | watchers: 927 | - ../queryResults.log 928 | - id: '1540' 929 | steps: 930 | - id: '1540.1' 931 | setup: 932 | watchers: 933 | - ../queryResults.log 934 | - id: '1550' 935 | steps: 936 | - id: '1550.1' 937 | setup: 938 | watchers: 939 | - ../queryResults.log 940 | - id: '1560' 941 | steps: 942 | - id: '1560.1' 943 | setup: 944 | watchers: 945 | - ../queryResults.log 946 | - id: '1570' 947 | steps: 948 | - id: '1570.1' 949 | setup: 950 | watchers: 951 | - ../queryResults.log 952 | - id: '1580' 953 | steps: 954 | - id: '1580.1' 955 | setup: 956 | watchers: 957 | - ../queryResults.log 958 | - id: '1590' 959 | steps: 960 | - id: '1590.1' 961 | setup: 962 | watchers: 963 | - ../queryResults.log 964 | - id: '1600' 965 | steps: 966 | - id: '1600.1' 967 | setup: 968 | watchers: 969 | - ../queryResults.log 970 | - id: '1610' 971 | steps: 972 | - id: '1610.1' 973 | setup: 974 | watchers: 975 | - ../queryResults.log 976 | - id: '1620' 977 | steps: 978 | - id: '1620.1' 979 | setup: 980 | watchers: 981 | - ../queryResults.log 982 | - id: '1630' 983 | steps: 984 | - id: '1630.1' 985 | setup: 986 | watchers: 987 | - ../queryResults.log 988 | - id: '1640' 989 | steps: 990 | - id: '1640.1' 991 | setup: 992 | watchers: 993 | - ../queryResults.log 994 | - id: '1650' 995 | steps: 996 | - id: '1650.1' 997 | setup: 998 | watchers: 999 | - ../queryResults.log 1000 | - id: '1660' 1001 | steps: 1002 | - id: '1660.1' 1003 | setup: 1004 | watchers: 1005 | - ../queryResults.log 1006 | - id: '1670' 1007 | steps: 1008 | - id: '1670.1' 1009 | setup: 1010 | watchers: 1011 | - ../queryResults.log 1012 | - id: '1680' 1013 | steps: 1014 | - id: '1680.1' 1015 | setup: 1016 | watchers: 1017 | - ../queryResults.log 1018 | --------------------------------------------------------------------------------