Tuesday, March 28, 2017

SQL Basics

SQL BASICS

In the middle of last month, I began my online SQL course. And we are now in the last week of the online course. It's a six weeks course. Since I have a programming background, I was able to pass all the quizzes with a 100% score each, except for two where I missed 1 question each. But since you can retake the quizzes, I got 100% in all of them.

Here is the basic summary of the course I'm taking.

SQL is the acronym for Structured Query Language, the standard language for communicating with a RDBMS or DBMS. RDBMS stands for Relational Database Management System. Examples of RDBMS and DBMS are Microsoft Access, MySQL, Microsoft SQL Server, Oracle, MariaDB, SQLite, IBM DB2, IBM Informix, Sybase, Teradata, Corel Paradox, dBase, LibreOffice Base, and FoxPro.

RDBMS and DBMS creates and stores databases. Databases consist of two dimensional tables. Tables consist of records and fields. Records and fields make up all the data about a certain information. Examples of this information are a student's permanent school record, your voting record, your cell phone data information, your library card record, and your hotel reservation to Disneyland.

Here is an example of a database table of records.

DATABASE TABLE NAME: Celebrities
CID FName  MName LName     City           State
1   DONALD JOHN  TRUMP     Washington     DC
2   JOHN        D        SINDAYEN  Las Vegas      NV
3   JOHN        F        KENNEDY   New Heaven     CT
4   JOHN                   KEATS        Valhalla       BC
5   JOHN                   DENVER     Denver         CO

Here are examples of SQL queries in the above database table.

SQL query to select everything in the database table:
SELECT FName, MName, LName, City, State
FROM Celebrities;
or
SELECT *
FROM Celebrities;

SQL query to count the number of records in the database table:
SELECT COUNT(CID) AS TotalRecords
FROM Celebrities;

SQL query to count the number of distinct first names in the database table:
SELECT COUNT(DISTINCT FName) AS DistinctFName
FROM Celebrities;

SQL query to count the number of cities between A and E.
SELECT COUNT(City) AS CityCount
FROM Celebrities
WHERE City BETWEEN 'A' AND 'E';

SQL query to add a new record to the database table as a processed transaction:
BEGIN TRANSACTION
INSERT INTO Celebrities (FName, MName, LName, City, State)
VALUES ('JOHNNY', NULL, 'DEPP', 'HOLLYWOOD', 'CA')
SAVE TRANSACTION InsertDepp
IF @@ERROR <> 0 ROLLBACK TRANSACTION InsertDepp
COMMIT TRANSACTION

Transaction processing is not supported by all RDBMS and DBMS. Microsoft Access does not support transaction processing and it will probably not be able to do so in the future. But Microsoft Access is one of the easiest RDBMS around to work with and you don't have to be totally technically savvy to use it for SQL queries. You can also use it to create queries without writing SQL queries. You can just click the mouse to get the type of information you want out of the database table or tables.

Basic SQL keywords are the following, in no particular order:
SELECT
FROM
DISTINCT
WHERE
BETWEEN
LIKE
IN
AND
OR
NOT
ORDER BY
GROUP BY
HAVING
ASC
DESC
INSERT INTO
VALUES
IS NULL
NULL
UPDATE
SET
DELETE
FROM
AS
INNER JOIN
ON
LEFT JOIN
RIGHT JOIN
FULL JOIN
OUTER
CREATE TABLE
ALTER TABLE
ADD COLUMN
DROP TABLE
CREATE VIEW
DROP VIEW
BEGIN TRANSACTION
IF
ROLLBACK TRANSACTION
COMMIT TRANSACTION
PRIMARY KEY
UNIQUE
FOREIGN KEY
REFERENCES
CREATE INDEX
DROP INDEX
CREATE PROCEDURE
DECLARE
INTEGER
DROP PROCEDURE
CREATE DATABASE
DROP DATABASE
EXISTS
END
ELSE
SELECT TOP
TRUNCATE TABLE
UNION
UNION ALL

Basic SQL functions are the following:
COUNT
MIN
MAX
AVG
SUM
SQRT
RAND
CONCAT

May you find your answers to your queries,

John Sindayen

Friday, March 17, 2017

St. Patrick's Day

SAINT PATRICK'S DAY STORY

It was exactly on a Friday on St. Patrick's Day, March 17, when one event eventually put three strangers and three races into one juvenile courtroom in Los Angeles, apparently to intervene in the life of a very young man who was going down in the wrong path in life.

I was 17 and had just gotten off work from the Farmers building riding the Wilshire bus. I had thought of going to the mall that night.

I was riding the bus. It was very crowded and I was standing along with many others. An old small white lady, about 80 years old was sitting on the aisle seat in front of me.

I was minding my own business, when suddenly I saw a hand silently and slowly creeping into the handbag of the old lady in front of me.

Suddenly I turned to the teenager standing next to me and said "What are you doing? What in the name of God are you doing?" I remember these words because it was the same exact words I said to the lady judge when I was called to testify in court.

After I said I do in front of the bible that I will swear to tell the truth and nothing but the truth, the judge asked me to recall that day and tell her and everyone in the courtroom what happened. So I told her and everyone in the courtroom.

There was probably around 10 to 15 people in the courtroom that day. The old lady was there, the young teenage boy was there, and so were his parents. And I was there by myself, having ridden myself to the downtown courthouse in my usual fashion, by bus. The bailiff was there, and the court recorder, and the juvenile court judge.

I don't know who else was there, probably, some of relations of the old lady or the defendant teenage boy, or maybe other people waiting for their case.

Then I think the judge also asked me why did I stop the young man. And I said something like "because what he was doing was wrong and he should not do that."

After some testimonies were heard, the judge then excused me and probably the old lady also. The judge shook my hands and so did the old lady. And the black parents of the teenager also shook hands with me as the mother thank me for telling her about her son and told me that she was now going to take good care of his son so he won't go down the wrong way.

That was so many, many years ago, and I'm sure the mother has taken good care of his son so he will not end up on the wrong side of the law. And I'm sure the teenage boy, who was probably the same age as I was then or younger, was probably saved from going down the wrong path.

I would think so, because when I looked at his face inside the bus, I saw in him that he knew that what he was doing was wrong and he felt he was sorry. I believed that he was sorry because I mentioned God to him and he knew God did not approved of what he was doing.

I don't know why three strangers have suddenly come face to face in the courtroom that day. I have no need to save my life that day and I don't think neither did the old lady. I think it was to save the life of the teenage boy from going down the wrong road in life.

In hindsight, would have I done the same thing nowadays, or even back then? I do not know. Because you can never tell under what circumstances you may suddenly find yourself that suddenly the spirit of a hero, a fool, a coward, or a bystander suddenly takes over your very existence.

All I can say is a hero will always be a hero, a fool always a fool, and a coward always a coward, in varying degrees, all their lives.

C'est la vie!

John Sindayen

Saturday, March 11, 2017

Love & Marriage

LOVE AND MARRIAGE

When I was young, 18 to be exact, two of my coworkers and I visited one of my coworker's mother. A very few minutes after I got introduced to her mother who looked me over, her mother offered me a proposition. She offered me $10,000 in cash if I marry her granddaughter who was still in the Philippines and bring her here to America.

I didn't know what to say. But she pressed on. And I was left just thinking. I knew her granddaughter must be pretty because my married coworker and her mother were pretty. After what seemed like forever, though actually less than a minute, my coworker interrupted her mother and said something like I will think it over.

Had I told my father about this, I believed he would have told me to say yes. Because $10,000 was a lot of money to him.

But I was in a quandary. I have some sort of feeling for my other coworker. They were my first friends on the job when I got my first real full time job at 17. The three of us would go out together in my married coworker's car.

I even met her retired military husband whom she met back in the Philippines and her young daughter, in her house. We were like "The Three Musketeers", inseparable. She even introduced my father to horse racing because she was so worldly and my father was so homely. I admired her, and as for my other coworker, I adored her.

But I was naive back then. I didn't know what was good for me and what was bad. But mostly, I didn't know what to do. So after graduating from college, rather than confronting what I am feeling for my coworker, I enlisted in the army at 20 rather than confront my cowardice.

I left a good job, my good friends, my new car, all my worldly goods to my parents and many siblings to face a whole new adventure called the United States Army. But that's another story, and as I said I didn't know what was good for me back then.

I know some reader may still be thinking about that $10,000 proposition. What if you were offered that proposition? Had I known back then what true love is, I would have given the proposition serious consideration. That would have solve my marrying anymore. Because true love is hard to find.

Less than 5% of all people will say they found true love. And if you find it, your true love may not love you back. In fact arranged marriages is more desirable. Your parents will find you your wife or husband. No need for you to go on dating and hoping and looking and repeating the same process again and again. Just let your parents decide who to marry. And as I say, most people will never know true love. What is true love, anyway?

What is true love? True love is when a wooden plank can only hold one person and you choose your true love to be on it and you just holding on to it as you freeze in the cold ocean. Just like Leonardo in the movie "Titanic." True love is when you'd rather stay in the Titanic with your true love rather than go in a lifeboat. That's what true love is. True love is about being noble.

But true love has gone away these days along with the British nobility. There are no more British earls and viscounts, or barons or baronets, who hold large estates like they used to. All these noblemen have become no more than commoners. True love will only be experienced by a few, those of noble hearts who long for noble deeds.

Ever so faithful and true,

John Sindayen

Sunday, March 5, 2017

Getting A Job

GETTING A JOB

Sometimes you can't make up your mind what job to take or to try for. Sometimes you'd think you'd let fate pick your job for you. The thing is, every time I apply for a job, I got hired right away on the spot, almost always.

I am looking and waiting for the perfect job. That would be C's husband. Just kidding. That's not even a job. Trump's Press Public Relations Man. That guy needs a Press PR Man bad. I'll wait for his call.

All kidding asides, the perfect job for me would be where I will be able to help the organization or the Man or the Woman achieve their financial goal and/or popularity goal for the fiscal year and future fiscal years, while I also achieve the same goals.

My financial goal is very minimal. I require only a minimum living wage that will afford good housing and good nutrition. It's not that I'm independently wealthy, though past co-workers have accused me of being one. I don't even have a penny to my name. I will only say that I survive only through the kindness of strangers or through the sheer will of God who keeps me around just for company.

Somewhere out there is the perfect job for me or perfect enough for me. And maybe, the perfect lottery ticket, just to make these accusations of me being financially independent true. And also to make right all or any wrongs and expectations I've done or not done in my life. Selah.

Truthfully yours,

John Sindayen

PS: Jobs I am qualified for are the following:
Accounts Receivable Accounting Clerk, Prudential
Algebra or Mathematics Teacher or Tutor, LASD
Computer or Programming Teacher or Tutor, CSN
Data Entry, USCB
English or Composition Writer or Teacher or Tutor, Blogspot
Infantry or Armor Soldier or Instructor, USA
Martial Arts Instructor or Movie Extra, Dojo
Sales or Retail Clerk or Agent, Marshalls
Singer or Songwriter, Rooftop
Typist, Farmers
Etcetera, Etc.

Saturday, March 4, 2017

Chelsea Story 3

CHELSEA STORY 3

This continues the Chelsea Story. Here's part 3 of this story. Last we heard of the Chelsea Story is in February 11. So go back to that blog post if you've already forgotten.

Chelsea Story
Copyright 2017
By John Sindayen

Chapter 3

And she asked herself, "Now which apparel should I choose to slay a dragon today?
Red is fine but it's too flashy.
Silver is good but it's too shiny.
Gold is nice but it's too pricey."

And she would put her finger to her chin and ponder more, until she heard the people yell.
"Chelsea! Chelsea! Chelsea!"

Alas, she would make up her mind and chooses a lovely green dress. And away she pranced outside showing every one the green dress, including her mom.

"Mommy, look! Isn't this dress lovely!"

"Why that looks lovely, Chelsea!" Chelsea's mother would say, "But I'm afraid it would not do for today! Why, it's not even St. Patrick's Day!"

Happy March 2017!

John Sindayen

Friday, March 3, 2017

One Girl Power

ONE GIRL POWER

This is a true story going on all the time, since time immemorial, well, ever since that time when this one word was discovered.

One girl has the power to make everything all right. That's how powerful a girl is.

It may seem unbelievable but it is true. A girl has the power to change a world. She could change a hopeless world into a hopeful world that can change many worlds. That's how powerful one girl can be. If you understand why a girl can be so powerful, then you must know such a girl.

And do you know what can make one girl so powerful?

That is right!

"Yes!"

"Yes" contains all the power that can change a world.

"Yes, I will marry you!"

These are the words that can change someone's world and make everything all right. And one girl possess that power to make everything all right.

Cheers, your highness,

John Sindayen