Vrundesha Joshi has Published 343 Articles

Get the fields in each constraint in MySQL

Vrundesha Joshi

Vrundesha Joshi

Updated on 30-Jul-2019 22:30:24

45 Views

Let’s say we have a database “business” with number of tables. If you want to Get the fields in each constraint, then use the below query.The below query is to get the fields in each one of those constraints −mysql> select * −> from information_schema.key_column_usage −> where constraint_schema = 'business';The ... Read More

How to select domain name from email address in MySQL?

Vrundesha Joshi

Vrundesha Joshi

Updated on 30-Jul-2019 22:30:24

4K+ Views

To select domain name from email address, you can use in-built SUBSTRING_INDEX() function from MySQL.To understand the concept, let us create a table. The following is the query to create a table.mysql> create table selectDomainNameOnly −> ( −> UserEmailAddress varchar(200) −> ... Read More

Getting last 5 character of a string with MySQL query?

Vrundesha Joshi

Vrundesha Joshi

Updated on 30-Jul-2019 22:30:24

17K+ Views

To get the first n characters of string with MySQL, use LEFT(). To get the last n char of string, the RIGHT() method is used in MySQL.The syntax for RIGHT() method is as follows −SELECT RIGHT(yourColumnName, valueOfN) as anyVariableName from yourTableName;To understand the above concept, let us create a table. ... Read More

What should I do? Select int as currency or convert int to currency format in MySql?

Vrundesha Joshi

Vrundesha Joshi

Updated on 30-Jul-2019 22:30:24

387 Views

To convert int to current format, use CONCAT() with FORMAT() function from MySQL.The syntax is as follows −SELECT CONCAT(‘CurrencySymbol’, FORMAT(yourColumnName, valueAfterDecimal)) as AnyVariableName from yourTableName;To understand the above syntax, let us create a table. The query to create a table −mysql> create table AddingCurrencySymbolDemo −> ( ... Read More

MySQL query to extract first word from a field?

Vrundesha Joshi

Vrundesha Joshi

Updated on 30-Jul-2019 22:30:24

3K+ Views

To extract first word from a field, use in-built SUBSTRING_INDEX() function. The syntax is as follows −SELECT SUBSTRING_INDEX(yourColumnName, ’ ‘, 1) as anyVariableName from yourTableName;In the above query, if you use -1 in place of 1 then you will get the last word. To understand the above concept, let us ... Read More

Combine date and time column into a timestamp in MySQL?

Vrundesha Joshi

Vrundesha Joshi

Updated on 30-Jul-2019 22:30:24

11K+ Views

To combine date and time column into a timestamp, you can use cast() function with concat().The syntax is as follows −select cast(concat(yourDateColumnName, ' ', yourTimeColumnName) as datetime) as anyVariableName from yourTableName;In the above concept, you will use cast() when your date and time is in string format. The cast() function ... Read More

How to echo print statements while executing an SQL script?

Vrundesha Joshi

Vrundesha Joshi

Updated on 30-Jul-2019 22:30:24

2K+ Views

To perform echo print statements while executing SQL scripts, use the following syntax.The syntax is as follows −SELECT ‘anyStringValue as’ ‘;The query is as follows −mysql> select 'This is a SQL Script' AS' ';The following is the output −+----------------------+ | ... Read More

Get maximal GPS precision on mobile browser

Vrundesha Joshi

Vrundesha Joshi

Updated on 30-Jul-2019 22:30:22

172 Views

Built-in browser for Android will not give you accurate GPS location for security reasons. Test it with different web browsers that would need permissions to get the accurate location from GPS when installed.After switching GPS off, the data is received with < 10 meters accuracy.Do not use Android Browser for ... Read More

What is JavaScript garbage collection?

Vrundesha Joshi

Vrundesha Joshi

Updated on 30-Jul-2019 22:30:21

196 Views

JavaScript automatically allocates memory, while a variable is declared. Garbage collection finds memory no longer used by the application and releases it since it is of no use. Garbage collector uses algorithms like Mark-and-sweep algorithm, to find the memory no longer used.This algorithm is used to free memory when an ... Read More

How to convert Multidimensional PHP array to JavaScript array?

Vrundesha Joshi

Vrundesha Joshi

Updated on 30-Jul-2019 22:30:21

1K+ Views

You can use PHP array in JavaScript. It works for a single as well as the multidimensional array. Use the json_encode() method to achieve this.The following is the Multi-dimensional PHP array.$myArr= array( array('Amit', 'amit@example.com'), array('Rahul, 'rahul@example.com'), );Converting PHP multidimensional array into JavaScript. ... Read More

Advertisements