Gerrit-Jan Linker
|
SQL table An SQL table is a unit of data storage in a database. Through SQL the table can be manipulated. A table consists of columns. Think of it like a spreadsheet. Each column can have a name and a data type. The analogy to spreadsheets continues as the table also has rows. Each row contains data where each column is assigned a value or is left blank if permitted. SQL is the language to communicate to the database. You can use it to manipulate tables. You can first use SQL to create a table. E.g.: create table mytable(col1 number, col2 varchar2(100), col3 date); You can also change a table e.g. by adding a column. E.g.: alter table mytable add col4 number; Data can be added to the table using the SQL insert command. E.g.: insert into mytable (col1, col2, col3) values (1, 'hi', to_date('01-12-2008','dd-mm-yyyy'); Data can be manipulated in the table using the SQL update command. E.g.: update mytable set col2='bye' where col1=1; A row can also be removed using the SQL delete command. E.g.: delete from mytable where col1=1; When you need to do some reporting and just need to retrieve rows from the table for reporting purposes you can run the SQL select command. E.g.: select col1, col2, col3 from mytable where col1 < 100;
|