IBM DB2 Cloud Database and SQL : PART 2
In my last article, I talked about basic DDL and DML SQL commands to Create, Update and Delete table in the IBM DB2 cloud database. I also threw light on use of inbuilt functions such as Distinct, Count and Limit. Please check the article in link below-
In This article, I will focus on retrieving data from database using String Patterns, Ranges and Sets and further explore ‘Order by’ and ‘Group by’ clauses. I will be using ‘Customer’ table from the database which was created in previous article. As an overview, Customer table contains 4 fields, namely; CUSTOMER_ID, CUSTOMER_NAME, CUSTOMER_ADDRESS and CUSTOMER_ORDER_ID, furthermore, It holds 8 customer records as shown in below screenshot.
Retrieve data using STRING PATTERNS
Now, for instance, we need extract particulars customer data, however, we don’t remember respective customer_id or customer_name, but we do know that customer name starts with ‘S’. In such cases, we can use ‘%’ symbol along with known string in ‘WHERE’ clause. For instance, ‘S%’, this will retrieve records of all the customers having their…