ByteBoard Notes Notes

To display the entire content of the table

Informatics Practices XI · Experiment 24 of 36 · SQL

★ CBSE suggested11-IPSQL queries
Expt. No.24
Page No.48

Display the whole table

Aim

To display all the rows and columns of the STUDENT table.

Concepts used

Queries

USE school;SELECT * FROM student;

A marked line continues the line above it. In your file, write it on the same line.

Output

mysql> USE school; Database changed
mysql> SELECT * FROM student; +-----+-------+---------+--------+--------+------------+-------+ | rno | class | section | gender | name | dob | marks | +-----+-------+---------+--------+--------+------------+-------+ | 1 | XI | A | F | Aarohi | 2009-03-14 | 78 | | 2 | XI | A | M | Bharat | 2008-11-02 | 45 | | 3 | XI | B | M | Chetan | 2009-07-21 | NULL | | 4 | XI | B | F | Divya | 2009-01-30 | 91 | | 5 | XII | A | M | Eshan | 2008-05-17 | 66 | | 6 | XII | A | F | Fatima | 2008-09-09 | 83 | | 7 | XII | B | M | Gagan | 2007-12-25 | 38 | | 8 | XII | B | F | Hina | 2008-02-11 | NULL | | 9 | XI | A | M | Ishan | 2009-10-05 | 57 | | 10 | XII | A | F | Jaya | 2008-06-28 | 74 | +-----+-------+---------+--------+--------+------------+-------+ 10 rows in set

✓ Printed by running this query set, not typed by hand.

Result

SELECT * displayed all 10 rows and all 7 columns of the table.

Viva voce: what the examiner may ask

01What does * mean in SELECT?

All the columns of the table.

02How do you display only some columns?

List them: SELECT name, marks FROM student;.

03Does SELECT change the data in the table?

No. It only reads and displays it.

Variations for the lab test

  1. Display only the name and class of every student.
  2. Display the columns in a different order.
  3. Display marks + 5 for every student.
! Common mistake Writing SELECT * student; without FROM gives a syntax error.
Back to the 11-IP index