Sometimes it is necessary to combine together (concatenate) the results from several different fields. Each database provides a way to do this:

  • MySQL: CONCAT()
  • Oracle: CONCAT(), ||
  • SQL Server: +

The syntax for CONCAT() is as follows:

CONCAT(str1, str2, str3, …): Concatenate str1, str2, str3, and any other strings together. Please note the Oracle CONCAT() function only allows two arguments — only two strings can be put together at a time using this function. However, it is possible to concatenate more than two strings at a time in Oracle using ‘||’.

MySQL/Oracle:
SELECT CONCAT(region_name,store_name) FROM Geography
WHERE store_name = ‘Boston’;

Result:
‘EastBoston’

Oracle:
SELECT region_name || ‘ ‘ || store_name FROM Geography
WHERE store_name = ‘Boston’;

Result:
‘East Boston’

SQL Server:
SELECT region_name + ‘ ‘ + store_name FROM Geography
WHERE store_name = ‘Boston’;

Result:
‘East Boston’

Surgery postponed..

Surgery has been postponed.

After preparing the things we need to bring to the hospital, the admitting department would not admit my son because there’s no available room for us. Can you believe it!? As in no rooms from ward to suites. Been calling them since 2PM till 8PM for a room and they can’t provide any.

I don’t know. I guess I’m just disappointed. I wanted this thing to end up and start preparing for other stuff like his birthday. I wanted him to be able to recover soon so that he can play again with us & with his friends. But thinking.. maybe there’s a reason behind the ‘no available rooms yet’.. a reason that’s greater than that or something.

Orchiopexy (or orchidopexy) is a surgery to move an undescended testicle into the scrotum and permanently fix it there. It is performed by a pediatric urologist or surgeon on boys with cryptorchidism, typically before they reach the age of two. Some patients remain undiagnosed until their teenage years and undergo the surgery at that time.

The undescended testicle may be located within the normal line of descent (for example, in the inguinal canal) or high in the scrotum or ectopically (i.e. the abdomen). The surgeon may use an endoscope through the umbilicus to locate the testicle, and through other small opening(s) performs the procedure. The higher the testicle, the less successful the procedure. However, the procedure has a high success rate overall.
Read the rest of this entry »

Surgery it is..

After 3 weeks of injection treatment for undescended testes, the endocrinologist informed us that my 1 yr. 10 mos. old son really needs to undergo Bilateral Orchiopexy.

If only we have known this before, we should have at least had him the surgery weeks ago. At least the burden will no longer be like this and we can start on the recovery process.

So be it. On Thursday, we’ll be admitting him in the hospital.

I hope and pray that everything will be ok.

SQL Commands: Trim

The TRIM function in SQL is used to remove specified prefix or suffix from a string. The most common pattern being removed is white spaces. This function is called differently in different databases:

  • MySQL: TRIM(), RTRIM(), LTRIM()
  • Oracle: RTRIM(), LTRIM()
  • SQL Server: RTRIM(), LTRIM()

The syntax for these trim functions are:

TRIM([[LOCATION] [remstr] FROM ] str): [LOCATION] can be either LEADING, TRAILING, or BOTH. This function gets rid of the [remstr] pattern from either the beginning of the string or the end of the string, or both. If no [remstr] is specified, white spaces are removed.

LTRIM(str): Removes all white spaces from the beginning of the string.

RTRIM(str): Removes all white spaces at the end of the string.

Example 1:

SELECT TRIM(’ Sample ‘);

Result:
‘Sample’

Example 2:

SELECT LTRIM(’ Sample ‘);

Result:
‘Sample ‘

Example 3:

SELECT RTRIM(’ Sample ‘);

Result:
‘ Sample’

The Substring function in SQL is used to grab a portion of the stored data. This function is called differently for the different databases:

  • MySQL: SUBSTR(), SUBSTRING()
  • Oracle: SUBSTR()
  • SQL Server: SUBSTRING()

SUBSTR(str,pos): Select all characters from starting with position . Note that this syntax is not supported in SQL Server.

SUBSTR(str,pos,len): Starting with the th character in string and select the next characters.

Example 1:

SELECT SUBSTR(store_name, 3)
FROM Geography
WHERE store_name = ‘Los Angeles’;

Result:
’s Angeles’

Example 2:

SELECT SUBSTR(store_name,2,4)
FROM Geography
WHERE store_name = ‘San Diego’;

Result:
‘an D’

Ingredients: 
· 1 kilo potatoes
· 1 big chicken breast
· 3 pieces medium sized carrots
· 500 ml mayonnaise
· 1 can (836 g) pineapple tidbits or chunks
· 1/2 cup sweet pickle relish
· 1 cup cheddar cheese, diced (optional)
· 3 tablespoons of chopped spring onions (optional)
· Iodized salt to taste (pepper, optional)
Read the rest of this entry »

« Older entries