Category Archive: MySql

May 16

Mysql Function

Mysql Function Mysql inbuild function as follow by categories Aggregate Function AVG – Calculate Average value of given set of expression Example: select AVG(column) from tbl_name Table (prdprice) id Name Price 25 Pencil 250.00 35 Phone 1525.00 36 Pen 254.00 58 Note Book 450.00 select AVG(price) from prdprice Output AVG(price) 619.75 COUNT – Count the …

Continue reading »

Dec 14

Find the Nth Highest Salary

See on following table records Emp1 Table Emp ID              Salary 1                          10000 2                          25000 3                     …

Continue reading »

Dec 14

Get Record with Highest Amount in Given Hour

We can achieve this approach using join table it self. create table t1(id int, date datetime, amount int) insert into data values (1,’2014-10-11 15:15:00′,150), (2,’2014-10-11 15:20:00′,50), (3,’2014-10-11 18:30:00′,100), (4,’2014-10-11 18:40:00′,10), (5,’2014-10-11 21:10:00′,40), (6,’2014-10-11 21:20:00′,80); Table Structure with data ID         Date                       …

Continue reading »

Oct 02

Prevent from SQL Injection Attack

SQL injection attacks is the malicious attack by hacker. In this process SQL command injected into predefine SQL query in order to alter outcome of the query. When SQL is used to display data on a web page, it is common to let web users input their own search values. SQL Injection Based on 1=1 …

Continue reading »

Older posts «