Skip to main content


Showing posts from November, 2021

SQL quick bite 01 (Getting Top entries, Filtering and UNION)

1) Using * in your query * means all columns if there is no filtering or where condition then it fetches all rows 2) Use of quotes use single quote ' ' to add space for concatenation in the query use double quote "Customer Name" for AS names else it cannot run with a space in the query.  use concat function: SELECT concat(firstname, ' ' , lastname) as "Customer Name" from table cannot concat char + int. we need to CAST datatype to be the same type.  3) To get Top entries SELECT TOP - This allows us to limit the number or percentage of rows returned by a query.  eg. SELECT TOP n  where n is a number eg SELECT TOP 10 or TOP n Percent eg. SELECT TOP 10 Percent eg. SELECT TOP n WITH TIES - retrieve duplicates where applicable (nondeterministic) OFFSET-FETCH is an extension to the ORDER BY clause: -allows filtering a requested range of rows -provides a mechanism for paging through results - specify a number of rows to skip, number of rows to retrieve. eg.

Book Review: Make it stick

Let's take a break from coding and read a book. Actually, I listen to this book. I got it as an audiobook from the overdrive app. With so many things to learn, I had been exploring ways that I can learn more effectively.  Even though I was a teacher, I feel the learning strategies that I gave to students stem mainly from my own learning experience.  How I begin to wonder if there are the most effective though it appears as a tried and tested method.  It involves mainly re-reading, reviewing and making your own notes. As with all learning methods, I do understand that all skills will be effective at different degrees. I am sure you have friends who do not make notes at all and still scored Aces for their final university papers.  And this is where I had been self-defeating, I told myself that they are genius while I could only get by with sheer hard work. Looking back, I was at my best during my secondary school years when I had to teach my friends the concepts and when there are a

Python quick bite 03 - List Comprehension

 Here is another quick bite on a python concept. Looks like I am enjoying this short post too much. Ops. Gonna prepare a longer post next. To iterate through a list and adding the item to a list will look something like this. In this example, I will iterate a word and change it to a list.  #1. You need an empty list. empty_list = [] #2. You need the word you to iterate and a for loop. word = "Comprehension" for letter in word: # the letter is just for you to iterate (you can iterate through a string/list)     empty_list.append(letter) #if you print the empty_list, you will get this output ['C','o','m','p','r','e','h','e','n','s','i','o','n'] With the use of list comprehension, the whole code is greatly shortened. The syntax looks something like this: new_list = [ expression for item in iterable_item] This works by first looping through the item in iterable_item like list/

Python quick bite 02 - OOP

OOP - Object Oriented Programming  From " Object-oriented programming is a  programming paradigm  that provides a means of structuring programs so that properties and behaviors are bundled into individual  objects ." To make use of this, we need to import the module and we can find many such packages available for use in the coding community. And how important it is to know how to read their documentation and make use of it. Thus allowing to code more complex systems.  Basically, before we can create buildings aka objects, we need a blue-print and that is the class. The class will specify two aspects of the object, namely what is have = attributes and what it can do = methods.  To create a Class #we need to use Pascal Case for class naming to differentiate from variables naming which is in all lowercase. eg 1. class WaterBottle: #if you have an empty class, python can't run so we need to add "pass" to jump over this empty gap.               pass