NPM/PostgreSQL Flashcards
What is NPM?
world's largest software registry. Node Package Manager. consists of 3 distinct components: 1. the website 2. the Command Line Interface 3. the registry
What is a package?
reusable codes.
a Node Modules or contain Node Modules.
is a file or directory and a package.json file.
How can you create a package.json with npm?
npm init –yes
What is a dependency and how to you add one to a package?
dependency - the other modules that this module uses. to specify the packages your project depends on. someone else's code, for the project to run on
You can add dependencies to a package.json file from the command line or by manually editing the package.json file.
from command line: npm install [–save-prod]
manually: add an attribute called ‘dependencies’ that references the name and semantic version of each dependency.
{ "name": "my_package", "version": "1.0.0", "dependencies": { "my_dep": "^1.0.0", "another_dep": "~2.2.0" } }
What happens when you add a dependency to a package with npm?
the package is automatically added as a dependency
What is PostgreSQL and what are some alternative relational databases?
PostgreSQL is an open source object-relational database system (relational database system).
alternatives are Microsoft SQL Server, MySQL, Oracle Database. maybes = MongoDB, Redis, Neo4j
What are some advantages of learning a relational database?
Simple Model. A Relational Database system is the most simple model, as it does not require any complex structuring. Data Accuracy, Easy access to Data. Used very frequently, it’s all shared query language. share the same syntax. compacted very well. good at preventing data duplication. very flexible based on what the data is. Essentially a table
What is one way to see if PostgreSQL is running?
on terminal enter the command / having the top command.
sudo service postgresql status
What is a database schema?
is a collection of tables. defines the structure of databas.
What is a table?
A table is a list of rows each having the same set of attributes. For example, all students in a “students” table could have “firstName”, “lastName”, and “dateOfBirth” attributes. Attributes are commonly referred to as columns
What is a row?
is the actual record of single data.
the table it defines what each row should have, each row is the instance of the data.
What is SQL and how is it different from languages like JavaScript?
is the primary way of interacting with relational databases. way of retrieving, creating, and manipulating data in a relational database.
it differs from JS which is an imperative programming language, whereas SQL is a declarative programming language. => describes the results they want and the programming environment comes up with its own plan for getting the results (like HTML CSS)
How do you retrieve specific columns from a database table?
with SELECT keyword
SELECT “attribute” (if more than one ,)
FROM clause “table”
How do you filter rows based on some specific criteria?
after FROM clause use WHERE clause “column” = > < != ‘field’
What are the benefits of formatting your SQL?
for consistent style and readability