SQL Database
WHAT IS DATABASE AND mySQL?
Database is collection of data stored in such manner that it can be easily accessed.
So you have a database managment system which connects computer to database
There are two types of databse first is relational & another is nonrelational and afer this mySQL is use for non relational database
SELECT STATEMENT
USE sql_inventory;
SELECT *
FROM products
-- WHERE product_id = 1
ORDER BY name;
above statement tells that select the data base called sql_inventory then select all things from table called products and sort them by their name || select the products whose id is
SELECT
name,
quantity_in_stock,
(quantity_in_stock+10)*(100) AS 'factor'
FROM products
above statement selects the columns named name,quantity_in_stock,and in last columned named factor it puts each value of column quantity_in_stock by performing arithmetic operations in it.
SELECT DISTINCT quantity_in_stock FROM sql_inventory.products;
above code removes duplicated
SELECT * FROM sql_inventory.products WHERE unit_price <= 3.00;
filtering of databases
SELECT name FROM sql_inventory.products WHERE quantity_in_stock=38 OR quantity_in_stock=64 OR quantity_in_stock=90 ;
SELECT name FROM sql_inventory.products WHERE quantity_in_stock IN (38,64,90) ;
IN vs OR
SQL & REGULAR EXPRESSIONS