Showing entries 151 to 160 of 1182
« 10 Newer Entries | 10 Older Entries »
Displaying posts with tag: sql (reset)
MySQL EXPLAIN ANALYZE

MySQL 8.0.18 was just released, and it contains a brand new feature to analyze and understand how queries are executed: EXPLAIN ANALYZE.

What is it?

EXPLAIN ANALYZE is a profiling tool for your queries that will show you where MySQL spends time on your query and why.…

Facebook Twitter LinkedIn

SQL LTRIM Function Example | LTRIM In MySQL And SQL Server

SQL LTRIM Function Example is today’s topic. SQL LTRIM function is used for removing all the leading whitespaces or specified characters from the string, i.e. from the left-hand side of the string. In this tutorial, you will learn how to use a MySQL and SQL Server LTRIM() function to remove leading blanks from a string. Oracle/PLSQL LTRIM function removes all specified characters from the left-hand side of a string.

SQL LTRIM Function

The LTRIM() function returns the string after removing leading blanks.

The following shows the syntax of the LTRIM() function.

SELECT LTRIM (input_string, [trim_string])

PARAMETERS

Input_string: It is the string from where the characters have to be removed from the left-hand side.

Trim_string: It is completely optional. It is mainly used for specifying the characters to be removed. If this parameter is omitted, then …

[Read more]
SQL LOWER Function | Lower() Function In MySQL and SQL Server

Lower() Function Example In MySQL and SQL Server is today’s topic. The SQL LOWER function converts all the characters in a string into lowercase. If you want to convert all characters in a string into uppercase, you should use the UPPER function. SQL LOWER function is used for lowering the case of a string, i.e. all the characters in the specified string will be converted to lower case. This is one of the String functions.

SQL LOWER Function

See the following syntax.

SELECT LOWER (input_string)

PARAMETERS:

Input_string: It is the string whose characters are to be converted to lowercase. The input string can be any string or any table column.

NOTE:

If any number …

[Read more]
SQL Left Function Example | LEFT() In SQL Server And MySQL

SQL Left Function Example | LEFT() In SQL Server And MySQL is today’s topic. LEFT FUNCTION in SQL is used for extracting a substring starting from the left, followed by the number of characters. The LEFT() function extracts several characters from the string (starting from left).

SQL Left Function

The LEFT() function extracts a given number of characters from the left side of a supplied string.

The syntax of the LEFT() function is as follows.

SELECT LEFT (string, no_of_characters);

See the following parameters.

PARAMETERS:

  1. String: An input string from which the substring will be extracted and can be a literal string, variable or a column.
  2. No_of_characters: Number of characters you wish to extract from the string.

The LEFT() function returns a value of VARCHAR when …

[Read more]
How to Map MySQL’s TINYINT(1) to Boolean in jOOQ

MySQL 8 does not yet support the BOOLEAN type as specified in the SQL standard. There is a DDL "type" called BOOL, which is just an alias for TINYINT: create table t(b bool); select table_name, column_name, data_type, column_type from information_schema.columns where table_name = 't'; The above produces: TABLE_NAME|COLUMN_NAME|DATA_TYPE|COLUMN_TYPE| ----------|-----------|---------|-----------| t |b |tinyint |tinyint(1) | Notice … Continue reading How to Map MySQL’s TINYINT(1) to Boolean in jOOQ →

SQL CONCAT_WS Function Example | CONCAT_WS Method In SQL

SQL CONCAT_WS Function Example | CONCAT_WS Method In SQL is today’s topic. The SQL CONCAT_WS function is used to join two or more expressions separated by a separator. It takes up to 255 input strings which are further joined by a function. If we want to perform the join operation, CONCAT requires at least 2 strings. If it is provided with only 1 string, it will raise the error.

SQL CONCAT_WS Function

If any non-character string values are passed into the function, it will be implicitly converted to the strings before concatenating.

If NULL is added to the function, it converts it into the empty string with VARCHAR (1).

See the following syntax.

SELECT CONCAT_WS (separator, expression1, expression2, expression3…)

Parameters Separator

[Read more]
How to limit the SQL query result set to Top-N rows only

Introduction In this article, we are going to see how we can limit the SQL query result set to the Top-N rows only. Limiting the SQL result set is very important when the underlying query could end up fetching a very large number of records, which can have a significant impact on application performance. Why limit the number of rows of a SQL query? Fetching more data than necessary is the number one cause of data access performance issues. When a given business use case is developed, the amount of data available... Read More

The post How to limit the SQL query result set to Top-N rows only appeared first on Vlad Mihalcea.

SQL ORDER BY RANDOM

Introduction In this article, we are going to see how we can sort an SQL query result set using an ORDER BY clause that takes a RANDOM function provided by a database-specific function. This is a very handy trick, especially when you want to shuffle a given result set. Note that sorting a large result set using a RANDOM function might turn out to be very slow, so make sure you do that on small result sets. If you have to shuffle a large result set and limit it afterward, then it’s... Read More

The post SQL ORDER BY RANDOM appeared first on Vlad Mihalcea.

SQL Injection Example | What Is SQL Injection

SQL Injection Example | What Is SQL Injection is today’s topic. An SQL injection is a code injection technique that may lead to destroying your database. It is one of the most common web hacking techniques. It can also be defined as placement of malicious code in SQL statements from a web page input. Attackers can use the SQL Injection vulnerabilities to bypass the application security measures.

#What Is SQL Injection(S.I.)

SQL Injection (SQLi) is the type of injection attack that makes it possible to execute the malicious SQL statements. These statements control the database server behind a web application.

The SQL Injection vulnerability may affect any website or web application that uses the SQL database such as SQL Server, MySQL, Oracle, SQL Server, or others.

Cyber Criminals may use it to gain the unauthorized access to your sensitive data like customer information, personal data, trade …

[Read more]
SQL Views Example | Views In SQL Tutorial Explained In Detail

SQL Views Example | Views In SQL Tutorial is today’s topic. SQL views is a kind of virtual tables which have rows and columns as they are in a real database. A view can be accompanied with all the rows of a particular table or selected rows based on a certain condition. In Structured Query Language, a view is a virtual table based on the result-set of an SQL statement.

SQL VIEWS

SQL view contains rows and columns, just like the real table. The fields in the view are fields from one or more real tables in the database. You can add the SQL functions, WHERE, and JOIN statements …

[Read more]
Showing entries 151 to 160 of 1182
« 10 Newer Entries | 10 Older Entries »