BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

DBMS SQL Select Statement

By Chaitanya Singh | Filed Under: DBMS

SELECT statement is used to fetch (retrieve) the data from the database. In this tutorial, you will learn how to retrieve the desired data from the database using SELECT statement.

Syntax:

SELECT column1, column2, ...  
FROM table_name;  

DBLS SQL Select Examples:

Let’s say we have a table STUDENT that has 5 rows and the table attributes are: STU_ID, STU_NAME, AGE and ADDRESS. Table has 5 rows (tuples).

Fetching the entire record (all the columns): The following SQL query will fetch all the records from the STUDENT table.

SELECT  *  FROM STUDENT;  

Result:

STU_IDSTU_NAMEAGEADDRESS
1001Carl21Delhi
1002Harry22Delhi
1003Lucas22Noida
1004Will23Agra
1005Robert20Jaipur

Fetching selected columns: This SQL query will fetch the STU_ID field from the table for all the students.

SELECT STU_ID FROM STUDENT;  

Result:

STU_ID
------
1001
1002
1003
1004
1005

You can use the following query to fetch STU_NAME and ADDRESS from the table:

SELECT STU_NAME, ADDRESS FROM STUDENT; 

Result:

STU_NAMEADDRESS
CarlDelhi
HarryDelhi
LucasNoida
WillAgra
RobertJaipur

Fetching selected rows and columns: To fetch the student names from those records where age is greater than 21.

SELECT STU_NAME FROM STUDENT WHERE AGE > 21 ;  

Result:

STU_NAME
--------
Harry
Lucas
Will
❮ SQL DROPSQL INSERT Statement ❯

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

DBMS Tutorial

Basics

  • DBMS Tutorial
  • DBMS Introduction
  • Database Applications
  • DBMS vs File System
  • DBMS vs RDBMS
  • DBMS Architecture
  • Three-level DBMS architecture
  • View in DBMS
  • Abstraction
  • Instance & Schema
  • DBMS languages

Data Models

  • Data Models
  • ER Diagram
  • ER Design issues
  • Convert ER to table
  • DBMS Generalization
  • DBMS Specialization
  • DBMS Aggregration
  • Relational Model
  • Hierarchical Model
  • Constraints
  • Cardinality

Relational Database

  • RDBMS concepts
  • Relational Algebra
  • Relational Calculus
  • Keys Index
  • Primary Key
  • Super Key
  • Candidate Key
  • Foreign Key
  • Composite Key
  • Alternate Key

Normalization

  • Normalization
  • Functional dependency

Transaction Management

  • Transaction Management
  • ACID properties
  • Transaction States
  • DBMS Schedules
  • Serializability
  • Conflict Serializability
  • View Serializability
  • Recoverability Of Schedule
  • Failure Classification
  • Log based Recovery
  • DBMS Checkpoint
  • Deadlock

Concurrency Control

  • Concurrency Control
  • Lock based protocol
  • Timestamp based protocol
  • Validation based protocol

File Organization

  • File Organization
  • Sequential File Organization
  • Heap File Organization
  • Hash File Organization
  • DBMS ISAM
  • B+ File Organization
  • Cluster File Organization

SQL Introduction

  • SQL Introduction
  • SQL Characteristics
  • Advantages of SQL
  • SQL Commands
  • SQL Operators
  • SQL CREATE
  • SQL DROP
  • SQL SELECT
  • SQL INSERT

Copyright © 2012 – 2022 BeginnersBook . Privacy Policy . Sitemap