SQL Views   «Prev 

Customer Create SQL View - Exercise Result

You entered:
Remember that you must first create a name for the view, then devise the SELECT statement that will be used for it. Here is a look at the view statement that will perform the desired functionality. Remember, the name is not important, but the underlying SELECT statement is key.

CREATE view MyView 
as select * FROM
CustomerInfo, PhoneNumbers
CustomerInfo.CustomerID = PhoneNumbers.CustomerID
This will join the results from the tables based on CustomerID and will create a new view named MyView.
You will then be able to issue a single, simple statement to get the results any time:
select * from MyView

Are SQL Keywords case-sensitive?

The keywords CREATE, READ, UPDATE, and DELETE are not case-sensitive in ANSI SQL or in most common database systemscase-sensitive. This means you can write them in any combination of uppercase and lowercase letters, and the database will interpret them correctly. For example, all of the following statements are equivalent:
CREATE TABLE my_table;
create table my_table;
CrEaTe TaBlE My_TaBlE;

However, it's important to note the following:
  1. Table and column names are often case-sensitive, depending on the database system and configuration. This means `SELECT * FROM MyTable` might not be the same as `SELECT * FROM mytable`. It's best to check the documentation for your specific database to be sure.
  2. String comparisons are typically case-sensitive by default. To make them case-insensitive, you might need to use functions like `LOWER()` or `UPPER()`, or change the collation of the database or column.
  3. Some database systems might have specific keywords or features that are case-sensitive. It's always a good idea to consult the documentation for the database you're using to avoid any unexpected behavior.

Best practices for clarity and consistency:
  • While keywords are not case-sensitive, it's generally recommended to "write them in uppercase" to improve readability and maintain consistency in your code.
  • Be consistent with the case of table and column names throughout your queries to avoid potential errors.
  • Use explicit case-conversion functions when necessary to ensure accurate string comparisons.

By following these guidelines, you can write clear, reliable, and maintainable SQL code.

SEMrush Software