Monday, 12 February 2018

SQL - Code academy

relational database is a database that organizes information into one or more tables

A table is a collection of data organized into rows and columns. Tables are sometimes referred to as relations

Some of the most common data types are:

1. Integer, a positive or negative whole number
2. Text, a text string
3. Date, the date formatted as YYYY-MM-DD for the year, month, and day
4. Real, a decimal value


---------------------------------------------------------------------------
idnameage
1Justin Bieber22
2Beyonce Knowles33
3Jeremy Lin26
4Taylor Swift26

celebs4 rows
idINTEGER
nameTEXT
ageINTEGER


------------------------------------------------------------------------

create table celebs (id integer,name text,age integer);

----------------------------------------------

insert into celebs(id,name,age)
values(2,'beyonce knowles',33);

insert into celebs(id,name,age)
values(3,'jeremy lin',26);

insert into celebs(id,name,age)
values(4,'taylor swift',26);

select name from celebs;



-------------------------------------

update celebs
set age=22
where id=1;



select * from celebs;



idnameage
1Justin Bieber22
2Beyonce Knowles33
3Jeremy Lin26
4Taylor Swift26

No comments:

Post a Comment