AmitDiwan has Published 11365 Articles

HTML DOM Style borderImageSlice Property

AmitDiwan

AmitDiwan

Updated on 22-Oct-2019 13:00:28

50 Views

The HTML DOM borderImageSlice property is used to define how a border image is divided into regions. This is done by specifying the border image offsets in percentage,  number or global values.Following is the syntax for −Setting the borderImageSlice property −object.style.borderImageSlice = "number|%|fill|initial|inherit"The above properties are explained as follows −ValueDescriptionnumberIt is used ... Read More

Using variables with MySQL prepare statement

AmitDiwan

AmitDiwan

Updated on 10-Oct-2019 12:34:09

109 Views

Let us first create a table −mysql> create table DemoTable (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    FirstName varchar(20),    LastName varchar(20) ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(FirstName, LastName) values('John', 'Smith'); Query OK, ... Read More

MySQL query to count occurrences of distinct values and display the result in a new column?

AmitDiwan

AmitDiwan

Updated on 10-Oct-2019 12:31:39

472 Views

Let us first create a table −mysql> create table DemoTable (    Value int ); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(80); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values(90); Query OK, 1 ... Read More

Get the sum of last 3 digits from all the values in a column with MySQL

AmitDiwan

AmitDiwan

Updated on 10-Oct-2019 12:29:08

154 Views

Since we want the sum of last 3 digits, we need to use aggregate function SUM() along with RIGHT(). Let us first create a table −mysql> create table DemoTable (    Code int ); Query OK, 0 rows affected (0.77 sec)Insert some records in the table using insert command −mysql> ... Read More

How to update a value with substring of current value by removing the separator and numbers after a separator in MySQL?

AmitDiwan

AmitDiwan

Updated on 10-Oct-2019 12:27:38

414 Views

Here, let’s say you have a string with form “StringSeparatorNumber” form like John/56989. Now if you want to remove the number after separator /, then use the SUBSTRING_INDEX(). Let us first create a table −mysql> create table DemoTable (    StudentName varchar(100) ); Query OK, 0 rows affected (1.05 sec)Insert ... Read More

How can I find and replace in MySQL in a column with file path?

AmitDiwan

AmitDiwan

Updated on 10-Oct-2019 12:25:27

352 Views

For thus, use MySQL REPLACE(). Let us first create a table −mysql> create table DemoTable (    FolderLocation text ); Query OK, 0 rows affected (0.80 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('C/ProgramFiles/AllMySQLProgram'); Query OK, 1 row affected (0.13 sec) mysql> insert into ... Read More

Can you check for both a blank string and 0 in one condition with a single MySQL query?

AmitDiwan

AmitDiwan

Updated on 10-Oct-2019 12:23:19

47 Views

Yes, we can check for a blank string and 0 in a single condition. Let us first create a table −mysql> create table DemoTable (    ClientId varchar(40) ); Query OK, 0 rows affected (1.01 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('CLI-01'); Query ... Read More

How to collapse rows into a comma-delimited list with a single MySQL Query?

AmitDiwan

AmitDiwan

Updated on 10-Oct-2019 12:20:42

484 Views

To collapse rows into a comma-delimited list, use GROUP_CONCAT(). Let us first create a table −mysql> create table DemoTable (    Id int,    Name varchar(40) ); Query OK, 0 rows affected (0.52 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(100, 'Chris Brown'); Query ... Read More

sp_help for MySQL to display field types and foreign key constraints?

AmitDiwan

AmitDiwan

Updated on 10-Oct-2019 12:17:21

735 Views

In MySQL, you can achieve sp_help with the help of SHOW CREATE command.CASE 1 −For table, the syntax is as follows −SHOW CREATE TABLE yourTableName;CASE 2 −For stored procedure, the syntax is as follows −SHOW CREATE PROCEDURE yourProcedureName;Let us first create a table −mysql> create table DemoTable (    EmployeeId ... Read More

MySQL query to split the string “Learn With Ease” and return the last word?

AmitDiwan

AmitDiwan

Updated on 10-Oct-2019 12:13:15

241 Views

For this, you can use SUBSTRING_INDEX(). Let us first create a table −mysql> create table DemoTable (    Words TEXT ); Query OK, 0 rows affected (1.62 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Learn With Ease'); Query OK, 1 row affected (0.32 sec) ... Read More

Advertisements