SQL

SQL is a domain-specific language designed to manage and query data held in a relational database management system (RDBMS).

Basic SQL Commands:

WHERE Clause:

The WHERE clause is used to filter records. It is used to extract only the records that fulfill a specified condition.

SELECT * FROM table_name WHERE column_name operator value;

SQL Joins:

SQL Joins are used to combine rows from two or more tables based on a related column between them.

ORDER BY:

The ORDER BY keyword is used to sort the result set by one or more columns.

SELECT column1, column2
FROM table_name
ORDER BY column1 ASC, column2 DESC;

SQL Constraints:

Constraints are used to specify rules for the data in a table:

Exercises

Login

Follow the steps

show databases;
drop database logindb;
create database logindb;
use logindb;
create table login (
name varchar(255),
password varchar(255)
);
describe login;
insert into login values (‘piet’, ‘geheim’);
insert into login values (‘john’, ‘secret’);
select * from login;
select naam from login;
select * from login where name = ‘piet’;
delete from login where name = ‘john

Todo