SQL - Altering Relations

Last time we learned how to create a relational database schema and relations.  Now we will expand our knowledge about SQL.  Deleting objects of the SQL schema can be performed using the drop command.  For example, the following statement deletes the table test_table in its entirety (both the data - table entities, and the definition - relational schema):

drop table test_table;
Deleting the entire SQL schema is performed using the following statement:
drop schema UniSchema;
There are two options of the drop statement which can be specified: cascade and restrict.  The restrict option prevents the table from being deleted if the table is referenced, for example, by a foreign key of another table.  Unlike that, the cascade option deletes not only the specified table, but also the tables which reference the given table.  Options are specified at the end of the drop statement.


Existing definitions of SQL schema objects can be altered using the alter command.  For example, if we want to add the dateOfBirth attribute to the person table, we can do that by writing:

alter table person add dateOfBirth date;
As you can see, it is necessary to also state the type of the attribute we are adding.  An attribute can also be removed by using the alter and drop commands:
alter table person drop dateOfBirth [restrict/cascade];
Deletion of attributes can also be performed while specifying restrict or cascade option.


SQL - Basic Queries

As previously stated, a relational database can (in an informal and simplified manner) be viewed as a collection of tables.  One of the most important things a user (or administrator) expects from a database is a simple way of acquiring and manipulating table data, and representing it in a readable format.  This is achieved by writing and executing queries.
Queries are non-case sensitive (except in an array of characters), and multiple statements are separated with the ; sign.  The basic form of an SQL query is:

-- this is a comment

select A1, A2,...       -- A1, A2 etc. are attributes 
from r                  -- r is a relation (table)
where P;                -- P is a predicate
For example, if we want to display the names of all the classes in a department (from our UniDB example), we will execute the following query:
select name
from class;

-- we can also specify the distinct keyword to retrieve unique names:
select distinct name
from class;
If we want to retrieve only those attributes which satisfy a certain condition, we can also specify a predicate (condition):
select name
from class
where credits>5;
This was the basic and most simple form of an SQL query, and in the following articles we will discuss more complex queries.


5 Social Media Trends to Expect in 2017

What's the future of social media?  Learn what the experts are forecasting for 2017:

  1. Growth of Chatbots.  Artificial intelligence (AI) is on the rise, and anyone who's spoken to Apple's Siri knows that chatbots do a decent job of answering common questions.  In 2017, expect more companies to use bots for basic customer service queries, freeing humans up for more complex interactions.

  2. Video Domination.  Snapchat's video content receives over 10 billion daily views.  With more and more companies discovering how popular video can be, this type of content will become increasingly popular in business marketing strategies.

  3. Expiring Content.  Snapchat has led the way here as well.  With Snapchat Stories—which only last for 24 hours—people are feeling a greater sense of urgency about the content they consume.  Instagram has followed in Snapchat's footsteps by offering its own version of stories called Instagram Stories.  There is so much noise in the social media space that in the future, experts are predicting that more companies will create expiring content to get people's attention.

  4. More Vicarious Experiences.  It used to be that you could just post a photo of an event you visited, and that was enough.  Nowadays, people want more.  They're looking for vicarious experiences—for example, discovering what attending the event is like through live video or 360 images.  Expect to see a growth in live video as businesses create content that makes you feel like you're actually in attendance at various events.

  5. Growing Importance of Influencers.  Influencers are people with large fan bases who endorse specific products—Kim Kardashian, for example.  As businesses look for new, effective ways to reach their target audience, expect more and more companies to turn to influencers to promote their brands.


15 Inspirational Quotes to Help You Achieve your New Year's Resolution

Need some inspiration to reach your goals this year?  Print out these inspiring quotes and refer to them whenever you feel your motivation waning:

  1. “If you can dream it, you can do it.” - Walt Disney

  2. “It does not matter how slowly you go as long as you do not stop.” - Confucius

  3. “What you do today can improve all your tomorrows.” - Ralph Marston

  4. “Genius is 1% inspiration and 99% perspiration.” - Thomas Edison

  5. “Never, never, never give up.” - Winston Churchill

  6. “Do the difficult things while they are easy and do the great things while they are small.  A journey of 1,000 miles must begin with a single step.” - Lao Tzu

  7. “When you get into a tight place and everything goes against you, till it seems as though you could not hang on a minute longer, never give up then, for that is just the place and time that the tide will turn.” - Harriet Beecher Stowe

  8. “You were born to win but to be a winner, you must plan to win, prepare to win, and expect to win.” - Zig Ziglar

  9. “It always seems impossible until it's done.” - Nelson Mandela

  10. “You are never too old to set another goal or to dream a new dream.” - Les Brown

  11. “It's always too early to quit.” - Norman Vincent Peale

  12. “Motivation will almost always beat mere talent.” - Norman Ralph Augustine

  13. “Do the one thing you think you cannot do.  Fail at it.  Try again.  Do better the second time.  The only people who never tumble are those who never mount the high wire.  This is your moment. Own it.” - Oprah Winfrey

  14. “One finds limits by pushing them.” - Herbert Simon

  15. “I'd rather attempt to do something great and fail than to attempt to do nothing and succeed.” - Robert H. Schuller

5 Easy Tips to Impress People at Work

Want to earn that promotion?  Read on to learn 5 ways you can impress your boss and coworkers:

  1. Be Proactive.  If something needs to be done, roll up your sleeves and volunteer for the task.  Not only does this type of can-do behavior leave others with a favorable impression, but it also demonstrates leadership qualities—a skillset bosses look for when they're deciding who to promote.

  2. Respond to Email/Phone Calls within 24 Hours.  If you've ever had a colleague you had to repeatedly hound for a response, than you already know how frustrating it is when people don't communicate in a timely fashion.  Don't be that person!  Instead, make it your goal to respond to all requests within 24 hours, even if it's only to say, “I need more time on this.  I'll get back to you in 2 days.”

  3. Take Responsibility.  When something goes wrong, it's all too commonplace for people to point fingers.  Rather than doing that, acknowledge mistakes and frame them in a positive way by explaining how you'll tackle things differently in the future.

  4. Aim to Develop a Good Working Relationship with Your Coworkers.  If you've ever watched reality TV, you'll notice that on virtually every show, there's one person who declares, “I'm not here to make friends.”  Typically, that person gets sent home early.  While you don't have to be best buds with the people you work with, make an effort to be friendly.  You never know when you might need a favor from a coworker, and it's in your best interest to be seen as a team player.

  5. Stay Positive.  Have you ever had a coworker who complains constantly?  If so, you already know people go out of their way to avoid that person.  If you suspect you are that person, try to keep your complaints to yourself and maintain an upbeat attitude at work.  People who lift others' spirits—rather than fostering low morale—are enjoyable to work with.  By merely changing your attitude, you'll impress those around you with your positive nature.

5 Fun Facts about New Year's Eve

Ever wonder what the heck Auld Lang Syne means and why we sing it?  Learn the answer and other fun facts about our favorite end-of-the-year celebration:

  1. Auld Lang Syne Roughly Translates to “Times Gone By.”  The song means that we should remember the past, rather than forgetting old friends.  As for why we sing it (or mumble it since no one knows the words), blame Guy Lombardo.  In 1929, his band played in NYC on New Year's Eve.  Their set was broadcast on the radio, and Auld Lang Syne was the song he chose to perform at midnight.

  2. Stock Up on Kale.  As tradition has it, leafy greens are associated with wealth in the new year.  Supposedly, the more greens you eat on New Year's, the more prosperity you'll experience.  The same things is said about beans and peas, because of their resemblance to coins.  Bottom line?  Make healthy eating choices on New Year's Eve, then buy a lottery ticket.

  3. Firecrackers and Noisemakers Aren't Just for Merriment.  Traditionally, they were used to scare off evil spirits and to ensure that the upcoming year would be a lucky one.

  4. The Times Square Ball Is Older than Your Grandparents.  The first ball was dropped in Times Square in 1907, but it was very different from the ball we're familiar with today.  The original was only 700 pounds and 5 feet in diameter.  Today's ball is 11,875 pounds, 12 feet in diameter, and built to withstand high winds and fluctuating temperatures.

  5. And Speaking of Things that Are Older than Your Grandparents...Celebrating the new year is an ancient tradition that dates back 4,000 years.  Back then, the Babylonians would ring in the new year at the first full moon after the spring equinox.