Divide Column to Get Monthly Salary of Employees in MySQL Query

AmitDiwan
Updated on 31-Dec-2019 07:11:39

419 Views

Let us first create a table −mysql> create table DemoTable1957    (    EmployeeId int,    EmployeeName varchar(20),    EmployeeSalary int    ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1957 values(1, 'Chris', 240000); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1957 values(2, 'Bob', 120000); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1957 values(3, 'David', 180000); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1957 values(4, 'Mike', 650000); Query OK, 1 row affected (0.00 sec)Display all records from the table using ... Read More

Select Column If Condition is Met in MySQL

AmitDiwan
Updated on 31-Dec-2019 07:04:51

526 Views

Let us first get the current date −mysql> select curdate();This will produce the following output −+------------+ | curdate()  | +------------+ | 2019-12-15 | +------------+ 1 row in set (0.00 sec)Let us first create a table −mysql> create table DemoTable1956    (    ProductId int,    ProductName varchar(20),    CustomerName varchar(20),    ShippingDate date    ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1956 values(101, 'Product-1', 'Sam', '2019-10-11'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1956 values(102, 'Product-2', 'Carol', '2018-12-01'); Query OK, 1 row affected (0.00 sec) ... Read More

jQuery eq() Method

AmitDiwan
Updated on 31-Dec-2019 07:03:52

274 Views

The eq() method in jQuery is used to select an element with a specific index number. The index number begins at 0.SyntaxThe syntax is as follows −$(":eq(index)")Above, the parameter index is the index of the element.ExampleLet us now see an example to implement the jQuery eq() method − Live Demo    $(document).ready(function(){       $("button").click(function(){          $("p:eq(2)").css("color", "orange");       });    }); Student Info This is a demo text. Exam Info This is a demo text. Teacher's Info This is a demo text. Click me OutputThis will produce ... Read More

gmp_rootrem Function in PHP

karthikeya Boyini
Updated on 31-Dec-2019 07:01:47

103 Views

The gmp_rootrem() function is used to calculate the nth root of a GMP number. It returns the integer component of the nth root and remainder.Syntaxgmp_rootrem($n,$root)Parametersn − It can be GMP object in PHP version 5.6 and later. Can also be numeric strings.root − The root of the number nReturnThe gmp_rootrem()function returns the integer component of the nth root and remainder.ExampleThe following is an example −OutputThe following is the output −Array (    [0] => GMP Object ( [num] => 3 )    [1] => GMP Object ( [num] =>6 ) )

Fix Auto Increment Field in MySQL After Deleting Rows

AmitDiwan
Updated on 31-Dec-2019 07:01:43

636 Views

Let us first create a table −mysql> create table DemoTable1955    (    UserId int NOT NULL AUTO_INCREMENT    ,    PRIMARY KEY(UserId)    ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1955 values(); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1955 values(); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1955 values(); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1955 values(); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1955 values(); Query OK, 1 row affected (0.00 sec)Display ... Read More

Get Day Name for Corresponding Date in MySQL

AmitDiwan
Updated on 31-Dec-2019 06:59:51

139 Views

To fetch day name, use DAYNAME() function in MySQL. Let us first create a table −mysql> create table DemoTable1954    (    ShippingDate date    ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1954 values('2019-12-15'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1954 values('2018-04-11'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1954 values('2019-01-31'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1954 values('2016-10-01'); Query OK, 1 row affected (0.00 sec)Display all records from the table using select statement −mysql> select * ... Read More

intlchar_getcombiningclass Function in PHP

Samual Sam
Updated on 31-Dec-2019 06:59:42

73 Views

The IntlChar getCombiningClass() function is used to get the combining class of the value val.Syntaxint IntlChar::getCombiningClass (val)Parametersval − An integer or character encoded as a UTF-8 string.ReturnThe IntlChar getCombiningClass() function returns the combining class of the value val.ExampleThe following is an example −OutputThe following is the output −int(0) NULL

Display Custom Text in a New Column Based on Null Values in MySQL

AmitDiwan
Updated on 31-Dec-2019 06:57:30

597 Views

Let us first create a table −mysql> create table DemoTable1953    (    StudentName varchar(20)    ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1953 values('Chris'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1953 values(NULL); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1953 values('David'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1953 values(NULL); Query OK, 1 row affected (0.00 sec)Display all records from the table using select statement −mysql> select * from DemoTable1953;This will produce the following output −+-------------+ | ... Read More

jQuery Element Selector

AmitDiwan
Updated on 31-Dec-2019 06:55:41

214 Views

The element selector in jQuery is used to select all elements with the specific element name.SyntaxThe syntax is as follows −$("ele")Above, ele is the element to select.ExampleLet us now see an example to implement the jQuery element selector − Live Demo    $(document).ready(function(){       $("button").click(function(){          $("h2").css("color", "orange");       });    }); Student Info This is a demo text. Exam Info This is a demo text. Teacher's Info This is a demo text. Click me OutputThis will produce the following output −Above, click the button “Click me” to update heading color −

Set Custom Messages Based on Student Marks in MySQL

AmitDiwan
Updated on 31-Dec-2019 06:53:59

159 Views

For this, use CASE statement. Let us first create a table −mysql> create table DemoTable1952    (    Marks int    ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1952 values(35); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1952 values(65); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1952 values(55); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1952 values(39); Query OK, 1 row affected (0.00 sec)Display all records from the table using select statement −mysql> select * from DemoTable1952;This will produce ... Read More

Advertisements