The Wayback Machine - https://web.archive.org/web/20240118200127/https://www.geeksforgeeks.org/sql-literals/
Open In App
Related Articles

SQL Literals

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

There are four kinds of literal values supported in SQL. They are : Character string, Bit string, Exact numeric, and Approximate numeric. These are explained as following below.

  1. Character string :
    Character strings are written as a sequence of characters enveloped in single quotes. the only quote character is delineate at intervals a personality string by 2 single quotes. Some example of character strings are :

    • ‘My String’
    • ‘I love GeeksForGeeks’
    • ‘16378’
  2. Bit string :
    A bit string is written either as a sequence of 0s and 1s enveloped in single quotes and preceded by the letter ‘B’ or as a sequence of positional representation system digits enveloped in single quotes and preceded by the letter X’ some examples are given below :

    • B’10001011′
    • B’1′
    • B’0′
    • X’C 5′
    • X’0′
  3. Exact numeric :
    These literals ar written as a signed or unsigned decimal variety probably with mathematical notation. Samples of actual numeric literals are given below :

    • 8
    • 80
    • 80.00
    • 0.8
    • +88.88
    • -88.88
  4. Approximate numeric :
    Approximate numeric literals are written as actual numeric literals followed by the letter ‘E’, followed by a signed or unsigned number. Some example are :

    • 6E6
    • 66.6E6
    • +66E-6
    • 0.66E
    • -6.66E-8
Unlock the Power of Placement Preparation!
Feeling lost in OS, DBMS, CN, SQL, and DSA chaos? Our Complete Interview Preparation Course is the ultimate guide to conquer placements. Trusted by over 100,000+ geeks, this course is your roadmap to interview triumph.
Ready to dive in? Explore our Free Demo Content and join our Complete Interview Preparation course.

Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated : 10 Sep, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads