

It's also acceptable and common to break up the CREATE TABLE statement with some whitespace like this: CREATE TABLE employees( CREATE TABLE employees (id INTEGER, name TEXT, age INTEGER, is_manager BOOLEAN, salary INTEGER) Įach field name is followed by its datatype. To create a table, use the CREATE TABLE statement followed by the name of the table and the fields you want in the table. The CREATE TABLE statement is used to create a new table in a database. For most backend web servers, PostgreSQL is a more production-ready option, but SQLite is great for learning and for small systems. SQLite is a serverless database management system (DBMS) that has the ability to run within applications, whereas PostgreSQL uses a Client-Server model and requires a server to be installed and listening on a network, similar to an HTTP server.Īgain, in this course we will be working with SQLite, a lightweight and simple database. I usually choose one of these technologies if I'm doing SQL work. SQLite is a lightweight, embeddable, open-source database. Postgres is a very powerful, open-source, production-ready SQL database. Personally, SQLite and PostgreSQL are my favorites from the list above. While all of these Databases use SQL, each database defines specific rules, practices, and strategies that separate them from their competitors. Some of the most popular SQL Databases right now are: Let's dive deeper and talk about some of the popular SQL Databases and what makes them different from one another. SQL databases are table-based, NoSQL databases have a variety of different storage methods, such as document, key-value, graph, wide-column, and more.Ī few of the most popular NoSQL databases are:.SQL databases usually have a defined schema, NoSQL databases usually have dynamic schema.NoSQL databases are usually non-relational, SQL databases are usually relational (we'll talk more about what this means later).Some of the main differences between a SQL and NoSQL database are: While most relational databases are fairly similar, NoSQL databases tend to be fairly unique and are used for more niche purposes. For example, MongoDB uses MQL (MongoDB Query Language) and ElasticSearch simply has a JSON API. Each NoSQL typically has its own way of writing and executing queries. To put it simply, a NoSQL database is a database that does not use SQL (Structured Query Language). When talking about SQL databases, we also have to mention the elephant in the room: NoSQL. It's lightweight, but has limited functionality compared to the likes of PostgreSQL or MySQL – two of the more common production SQL technologies.Īnd I'll make sure to point out to you whenever some functionality we're working with is unique to SQLite. SQLite is great for embedded projects, web browsers, and toy projects.

In this course, we'll be using SQLite specifically.

Just because one SQL-compatible database does things a certain way, doesn't mean every SQL-compatible database will follow those exact same patterns. It's critical to understand that not all databases are created equal. For example:Īlthough many different databases use the SQL language, most of them will have their own dialect. You typically use it to interact with a specific database technology. For example, the users table might have 3 fields:Īnd finally, all statements end with a semi-colon. We'll talk more about tables later, but for now, you can think about them like structs or objects. SELECT * from users Īfter specifying fields, you need to indicate which table you want to pull the records from using the from statement followed by the name of the table. If you want to select every field in a record, you can use the shorthand * syntax. If you want to select more than one field, you can specify multiple fields separated by commas like this: SELECT id, name from users SELECT id from users Ī SELECT statement begins with the keyword SELECT followed by the fields you want to retrieve. Standard SELECT statements do not alter the state of the database. SELECT retrieves data from one or more tables. A SELECT statement is the most common operation in SQL – often called a "query". Let's write our own SQL statement from scratch.
