Math expression

 


Distinct -> no duplication

Dual -> dummy table which has only one row & one column used for math expression.

alias -> another name

in abs-> they have math & date function

negative -> postive

power -> select power(3,2) from dual;

         ans: 9

round off(right side,floor) :

select floor(3.466) from dual;


FLOOR(3.466)

------------

           3

round off(ceil,left side):

SQL> select ceil(3.466) from dual;


CEIL(3.466)

-----------

          4


square root:

select sqrt(9) from dual;


   SQRT(9)

----------

         3

log:

select log(10,10) from dual;


LOG(10,10)

----------

         1

Upper case:

 select UPPER('welcome hcl') from dual;


UPPER('WELC

-----------

WELCOME HCL

INTIAL CAP:

select INITCAP('welcome hcl') from dual;


INITCAP('WE

-----------

Welcome Hcl

2.SQL> select INITCAP('welcome hcl') as "Text" from dual;


Text

-----------

Welcome Hcl

sub string:

select  substr('Welcome',1,3) from dual;


SUB

---

Wel

-------------------------------------------------

UPDATING TABLE TO UPPER CASE:

-------------------------------------------------

 update student

  2  set name = UPPER(name);


5 rows updated.


SQL> select * from student;


       SNO NAME                           DOB       GRADE  LOCATION

---------- ------------------------------ --------- ------ --------

       101 VARDHAN                        17-NOV-22 9      AP

       102 KRUPA                          18-FEB-22 9.5    AP

       103 MAHA                           19-MAR-22 8.6    AP

       104 LOKI                           20-APR-22 9.6    AP

       105 INUSHA                         23-OCT-22 9.8    AP

DISTINCT:

1. select distinct grade from student;


GRADE

------

9.5

9.6

9

8.6

9.8

COUNT: HOW MANY RECORDS THERE IN PARTICULAR TABLE.

1.select count(*) from student;


  COUNT(*)

----------

         5

2. counting particular record;

select count(grade) from student where grade=9.8;


COUNT(GRADE)

------------

           1


Tags

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.