Section 1

Preview this deck

SELECT * FROM cats WHERE age=4;

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (68)

Section 1

(50 cards)

SELECT * FROM cats WHERE age=4;

Front

intro where function

Back

SELECT CONCAT_WS ( '-', title, autho_fname, authoer_lname FROM table

Front

shortcut to insert break between every

Back

SELECT UPPER('Hello World'); SELECT LOWER('Hello World');

Front

pick the case upper or lower

Back

DEFUALT

Front

auto insert if nothing provided

Back

SELECT released_year FROM books ORDER BY released_year DESC;

Front

how to ordre descending

Back

SELECT released_year FROM books ORDER BY released_year;

Front

how to order ascending

Back

WHERE clause

Front

choose specific data in a column

Back

UPDATE

Front

what table

Back

source filename.sql

Front

run saved queries in

Back

show databases;

Front

list available databses

Back

SHOW COLUMNS FROM tablename; DESC tablename;

Front

See details of a created table

Back

SELECT * FROM cats WHERE name='Egg';

Front

intro where funtion not case sensitive

Back

source folder/file.sql

Front

make sure to go into correct source

Back

ORDER BY

Front

A SQL clause that is useful for ordering the output of a SELECT query (for example, in ascending or descending order).

Back

DROP DATABASE database_name;

Front

delete a database

Back

SET

Front

the change you want to make

Back

mysql-ctl start;

Front

Start Sql cloud 9

Back

WHERE

Front

data you want to change

Back

SELECT DISTINCT ...... FROM ......;

Front

use distinct function properly

Back

mysql-ctl stop;

Front

Stop sql shell cloud 9

Back

SELECT ----

Front

choose columns in table, use comma to seperate for multiple columsn

Back

CREATE TABLE cats3 ( name VARCHAR(20) DEFAULT 'no name provided', age INT DEFAULT 99 );

Front

setting default code

Back

distinct

Front

use with select, gets rid of duplicates, only unique ttiles

Back

UPDATe

Front

altering exisitng data

Back

INSERT INTO table_name(column_name) VALUES (data);

Front

insert data into a created table

Back

CHAR LENGTH

Front

counts the characters

Back

SELECT CONCAT ( SUBSTRING(title, 1, 10), '...' ) AS 'short title' FROM books;

Front

Back

CREATE TABLE unique_cats ( cat_id INT NOT NULL, name VARCHAR(100), age INT, PRIMARY KEY (cat_id) );

Front

primer keys

Back

INSERT INTO table_name (column_name, column_name) VALUES (value, value), (value, value), (value, value);

Front

insert multiple pieces of data into a table

Back

USE <database name>;

Front

choose the database you want to work with

Back

aliases -- "AS **'

Front

change the column name when displayed

Back

SELECT DISTINCT author_fname, author_lname FROM books;

Front

connecting two columns and using distinct

Back

SELECT SUBSTRING(REPLACE(title, 'e', '3'), 1, 10) AS 'weird string' FROM books;

Front

Back

SUBSTRING (column , 1-5) AS 'short title'

Front

select specific character to pick out to display

Back

CREATE DATABASE database_name;

Front

general command to create a database

Back

NOT NULL

Front

makes a field required and not be null

Back

SELECT author_fname AS first, author_lname AS last, CONCAT(author_fname, ', ', author_lname) AS full FROM books;

Front

Back

CONCAT (author_fname,' space', author_lname 'text FROM table

Front

combine with text and add data

Back

INT

Front

used for whole numbers

Back

SELECT REPLACE('Hello World', 'Hell', '%$#@');

Front

Back

^CCtrl-C--exit!

Front

quit out of cloud 9 shelll

Back

VARCHAR (#)

Front

used for text/ # of character

Back

SELECT CHAR_LENGTH('Hello World');

Front

counts characters

Back

CREATE TABLE unique_cats2 ( cat_id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), age INT, PRIMARY KEY (cat_id) );

Front

auto increment adding a table

Back

SELECT REVERSE('Hello World');

Front

show everything backwards

Back

CREATE TABLE tablename ( column_name data_type, column_name data_type );

Front

How to create a table in a database

Back

DROP TABLE <tablename>;

Front

delete a table

Back

mysql-ctl cli;

Front

Start sql shell cloud 9

Back

DELETE

Front

use intsead of select to delete stuff

Back

SELECT CONCAT (x,y,z)

Front

combine column names together

Back

Section 2

(18 cards)

SELECT title, stock_quantity FROM books WHERE stock_quantity LIKE '____';

Front

more advanced wild card exmaple

Back

Aggregate functions

Front

combine data to get meanin out of it

Back

SELECT COUNT(*) FROM books;

Front

the count function

Back

SELECT title FROM books WHERE title LIKE '%\%%'

Front

show perecent signs

Back

limit

Front

limit the amount of data shown

Back

SELECT title, author_fname FROM books WHERE author_fname LIKE '%da%';

Front

example

Back

SELECT author_fname, author_lname, COUNT(*) FROM books GROUP BY author_lname;

Front

grouy by example

Back

SELECT title, pages FROM books ORDER BY pages ASC LIMIT 1;

Front

better way to get max or min when running query

Back

USE underscores in like

Front

to show exact character lengths

Back

SELECT released_year, COUNT(*) FROM books GROUP BY released_year;

Front

group by example

Back

SELECT title FROM books LIMIT 10;

Front

example of limit

Back

SELECT MIN/MAX (column name) FROM table;

Front

min/max example

Back

LIKE clause

Front

search for certain words in the data base

Back

SELECT title, author_fname, author_lname FROM books ORDER BY 3;

Front

short cut

Back

group by

Front

summarizes or aggregates identical data into single rows

Back

SELECT MIN/MAX (released_year) FROM books;

Front

min/max example

Back

SELECT title, released_year FROM books ORDER BY released_year DESC LIMIT 14;

Front

example of limit

Back

SELECT title, author_fname FROM books WHERE author_fname LIKE 'da%';

Front

example 2

Back