Select in SQL - Retrieve some fields (column)

 We have learned how to view all the records in a table, using the "select" statement.

The basic and general syntax is as follows:


 select * from TABLENAME;

The asterisk (*) indicates that all the fields in the table are selected.


We can specify the name of the fields that we want to see, separating them by commas:


 select title, author from books; 

The list of fields after the "select" selects the data corresponding to the named fields. In the previous example we select the "title" and "author" fields from the "books" table, showing all the records.

Comments

Popular posts from this blog

Data Consistency and Inconsistency - What is Difference

Cardinality in DBMS – max/minimum cardinality & examples

Relational Model in DBMS