Current Topic: 2.1.1.SQL Query with wildcard characters and REPLACE function
You have a privilege to create a quiz (QnA) related to this subject and obtain creativity score...
2.1.1.SQL Query with wildcard characters and REPLACE function
SQL query that starts with the select keyword can include another powerful keyword like...
After the like we can provide the pattern of what we are looking.
In the pattern we can use SQL wildcard caracters.
SQL Wildcard Characters
SQL wildcards are used to search for data within a table.
With SQL, the wildcards are:
% A substitute for zero or more characters
_ A substitute for a single character
[charlist] Sets and ranges of characters to match
[^charlist]
Was it clear so far?
or
[!charlist] Matches only a character NOT specified within the brackets
The functions in SQL There are many different functions embedded in the SQL language. While SQL is standardized across databases, the functions might have some differences.
I just provide one sample.
For example, we need to replace a piece of text in many records: in the column "City" or the table "Maps" we had for some names an extra character "\t".
This extra character (tab) must be replaced with a regular space " ".
In MySQL DB we would use the REPLACE function with the following syntax:
UPDATE Maps set City = REPLACE(City, '\t', ' ') WHERE INSTR(City, '\t') > 0
Similar functions can exist for other databases, but there is no guarantee that the function name and syntax will be exactly the same
Assignments: 1. Provide 2 samples of the select with each case.
2. Provide 3 QnA for the subject with good and bad samples
3. Research and provide 2 more samples of functions often used in SQL.
Email the samples and QnAs to dean@ituniversity.us