Suppose you have to display the products on a web page with all information in the products table. Some products may not have the summary but the other do. In this case, you can use the COALESCE function to return the product summary, and if the product summary is not provided, you get the first 50 characters from the product description.
You can use the CONCAT function to add the … to the end of the excerpt to make it more meaningful to users that the text they are reading is just the excerpt and there is more content if they click the read more link. Take a look at selected part of the model:. Take a look at the data in those tables closely. As you see, two students are registered for the particular course, while only the one was missing classes. The total absence hour was evaluated to NULL , because indeed, this student didn't miss any classes in this course instance.
This use case will be presented for the PostgreSQL database. Look at the table below. This is the result of some query, that shows what is the total sale for each brand in the particular month. I want to transponse the rows with columns create a pivot table. Notice that not in the every month product from the particular brand was sold. Let's take a look at the Postgres example. Unfortunately, the sell is recorded only in some of the months and only in those fields, the number of total sales is pasted.
As you probably expected, the rest of the fields contains NULL s. The repaired query looks as follows:. NULL s can make life problematic. Cookie Settings Accept All. Manage consent. Close Privacy Overview This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website.
These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience. Necessary Necessary. Necessary cookies are absolutely essential for the website to function properly.
These cookies ensure basic functionalities and security features of the website, anonymously. The cookie is used to store the user consent for the cookies in the category "Analytics". The cookies is used to store the user consent for the cookies in the category "Necessary".
The cookie is used to store the user consent for the cookies in the category "Other. The cookie is used to store the user consent for the cookies in the category "Performance". It does not store any personal data. Functional Functional. Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance Performance. Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors. Analytics Analytics. Analytical cookies are used to understand how visitors interact with the website.
0コメント