RIGHT function |
||||||
The function RIGHT that complements LEFT returns a specified number of characters from the right of a character expression:
Here is, for example, the way to determine the names of the ships that start and end with the same letter: The thing that we got an empty resulting set means that such ships are absent in our database. Let's take a combination - a class and a name of a ship. The combining of two string values into one is called concatenation, and in the A database management system (DBMS) by Microsoft Corporation. SQL(Structured Query Language) is a database computer language designed for the retrieval and management of data in relational database management systems (RDBMS), database schema creation and modification, and database object access control management.SQL Server sign "+" is used for this operation ("||" in standard). So,
Here we separate by space the class and the name of a ship. Besides, in order not to repeat the whole construction in the function argument, we use a subquery. The result will look like this:
But what if a string expression will contain only one character? The query will output it. You can easily check it by
In order to exclude this case, one more useful function LEN can be used. Suggested exercises: (-7) |