0% found this document useful (0 votes)
9 views2 pages

MySQL Library Function Codes

The document provides a comprehensive list of MySQL library functions categorized into string functions, mathematical functions, and date and time functions. Each category includes various SQL queries demonstrating the usage of these functions, such as LENGTH, LOWER, ROUND, and CURDATE. The examples illustrate how to manipulate strings, perform mathematical calculations, and handle date and time data within a MySQL database.

Uploaded by

domaininitial4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

MySQL Library Function Codes

The document provides a comprehensive list of MySQL library functions categorized into string functions, mathematical functions, and date and time functions. Each category includes various SQL queries demonstrating the usage of these functions, such as LENGTH, LOWER, ROUND, and CURDATE. The examples illustrate how to manipulate strings, perform mathematical calculations, and handle date and time data within a MySQL database.

Uploaded by

domaininitial4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

MySQL LIBRARY FUNCTIONS CODES

-----------------------------------------------------
-----------------------------------------------------
STRING FUNCTIONS
-----------------
use csip;

select * from product;

select LENGTH("India!!");

Select Length(Pname) from Product;

Select Lower("WELCOME!!");

Select Lcase(PNAME) from product;

Select ucase("WELCOME!!");

Select Upper(Pname) from Product;

Select Substring("Welcome to India!!!",4,12);

Select mid("Welcome to India!!!",4,12);

Select substr("Welcome to India!!!",4,12);

Select Mid(Company,2,5) from Product;

Select Trim(" Welcome Home ") As OUTPUT;

Select LTrim(" Welcome Home ") As OUTPUT;

Select RTrim(" Welcome Home ") As OUTPUT;

Select Left("Welcome to India!!!",14);

Select Right("Welcome to India!!!",16);

Select Instr('Welcome Home','om');

SELECT iNSTR('Welcome HOME','OM');

Select Instr(Company,'s') from Product;


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

MATHEMATICAL FUNCTIONS
-----------------------
Select 23%4;
Select 23 mod 4;
select mod(23,4);

select sqrt(25);

select sign(345),sign(-72),sign(0);

select round(price,1) from product;


select round(price) from product;

Select round(8365.482,1);
Select round(8365.482,2);
Select round(8365.482,-1);
Select round(8365.482,-2);

Select truncate(8365.482,1);
Select truncate(8365.482,2);
Select truncate(8365.482,-1);
Select TRUNCATE(8365.482,-2);
--------------------------------------------------------
--------------------------------------------------------
DATE AND TIME FNCTIONS
----------------------
select curdate();
Select Current_Date();
Select Current_Date;

Select Date("2008-05-19 10:20:45");


Select Month(CurDate());
Select Month("2008-05-19");
Select Month(DOP) from Product;

Select Year(CurDate());
Select Year("2008-05-19");
Select Year(DOP) from Product;

Select Dayname(CurDate());
Select Dayname("2008-05-19");
Select Dayname(DOP) from Product;

Select DayofMonth(CurDate());
Select DayofMonth("2008-05-19");
Select DayofMonth(DOP) from Product;

Select DayofWeek(CurDate());
Select DayofWeek("2008-05-19");
Select DayofWeek(DOP) from Product;

Select DayofYear(CurDate());
Select DayofYear("2008-05-19");
Select DayofYear(DOP) from Product;

Select Now();
Select Sysdate();

Select Now(),Sleep(2),Now();

Select Sysdate(),Sleep(2),Sysdate();

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy