SQL Conversion Functions.pptx

RUBAB79 55 views 6 slides Jun 21, 2022
Slide 1
Slide 1 of 6
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6

About This Presentation

Database Slides for DIT students


Slide Content

SQL Conversion Functions By: Ms. Rubab [email protected] IBA ITC Sobhodero Managed By Khairpur Campus, IBA Sukkur University By: Ms. Rubab For DIT

SQL | Conversion Function By: Ms. Rubab For DIT

Implicit Data Conversion Implicit Data-Type Conversion : In this type of conversion the data is converted from one type to another implicitly (by itself/automatically). Example: from varchar to number By: Ms. Rubab For DIT

Example of Implicit conversion Query 1: Query 2: SELECT  Fees  FROM   `students`   WHERE  fees > 2000 ‘Here 2000 is in number form’ Query 2: SELECT  Fees  FROM   `students`   WHERE  fees > '2000’ ‘Here 2000 is in text/string form’ The output of both queries will be same because SQL automatically converts the text to number By: Ms. Rubab For DIT

Explicit Datatype conversion By: Ms. Rubab For DIT

Explicit Conversion TO_CHAR Function : TO_CHAR function is used to typecast a numeric or date input to character type with a format model (optional). SYNTAX : TO_CHAR(number1, [format], [ nls_parameter ]) By: Ms. Rubab For DIT