You can use substring() for fields in MySQL to get part of string. Following is the syntax − , Let us first create a table − , Insert records in the table using insert command − , Display all records from the table using select statement − , This will produce the following output − , Following is the query to use substring() method for fields − , This wil.....
You can use aggregate function MAX() and MIN() for this. Let us first create a table − , Insert records in the table using insert command − , Display all records from the table using select statement − , This will produce the following output − , Following is the query to get MAX and MIN values along with their row id − , This will produce the following output .....
You can use a CASE statement for this. Let us first create a table − , Insert records in the table using insert command − , Display all records from the table using select statement. The query is as follows − , This will produce the following output − , Following is the query to order by selected record in MySQL − , This will produce the following output − ,
You can use STR_TO_DATE() function. Let us first create a table − , Insert records in the table using insert command − , Display all records from the table using select statement − , This will produce the following output − , Following is the query to sort order by date ASC − , This will produce the following output − ,
You can use LPAD() along with rand() and floor() to generate 6-digit random number. Let us first create a table − , Insert records in the table using insert command − , Display all records from the table using select statement − , This will produce the following output − , Following is the query to generate 6-digit random number in MySQL − , Let us display the .....
If you do not specify unsigned, then bigint will be signed. If you specify an unsigned, then bigint will be unsigned. Let us first create a table − , Insert records in the table using insert command − , Display all records from the table using select statement − , This will produce the following output − ,
You can use BINARY along with the LIKE operator. Let us first create a table − , Insert records in the table using insert command − , Display all records from the table using select statement − , This will produce the following output − , Following is the query to search a word by the small letter − , This will produce the following output − , NOTE: If yo.....
You can use RIGHT() function from MySQL to get the last 12 digits from a string. Let us first create a table − , Insert records in the table using insert command − , Display all records from the table using select statement − , This will produce the following output − , Following is the query to get last 12 digits from a string in MySQL − , This will produce th.....
The IF() function returns a value based on a condition. The syntax is as follows− , Insert records in the table using insert command − , Display all records from the table using select statement − , This will produce the following output − , Here is the query to implement IF() in MySQL − , This will produce the following output− ,
Sign up now to get your own personalized profile!
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more