SQL Cheatsheet

Overview

In this post, I’m sharing my experiences with learning SQL, particularly focusing on crafting queries for some databases that I was experienced with. I’ll demonstrate some basic query examples and discuss insights gained along the way, hoping to help others who are also starting their SQL journey.


Why SQL?

Like MySQL in my blog applicaiton, even if I don’t interact with them daily in tasks like blog management, it is still highly beneficial for learning the SQL to understanding the role of databases.


SQL Queries for “wp_posts” Table (WordPress)

Select All Posts:

SELECT * FROM wp_posts;

Select Specific Columns:

SELECT ID, post_title, post_date FROM wp_posts;

Select Posts with a Specific Condition:

SELECT * FROM wp_posts WHERE post_status = 'publish';

SQL Queries for “AccountActivity” Table

SELECT * FROM [AdfsArtifactStore].[ArtifactStore].[AccountActivity];