<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Technology Tips</title>
	<atom:link href="https://www.1keydata.com/blog/feed" rel="self" type="application/rss+xml" />
	<link>https://www.1keydata.com/blog</link>
	<description>Tips and how-to&#039;s on technology, software, and building a website</description>
	<lastBuildDate>Sat, 18 Jun 2022 23:02:30 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Today&#8217;s Date in SQL</title>
		<link>https://www.1keydata.com/blog/todays-date-in-sql.html</link>
		
		<dc:creator><![CDATA[topcat]]></dc:creator>
		<pubDate>Sat, 18 Jun 2022 23:02:30 +0000</pubDate>
				<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">https://www.1keydata.com/blog/?p=1333</guid>

					<description><![CDATA[<p>One use case that happens often in SQL is the need to retrieve today&#8217;s date. This could be you are doing an analysis based on recent data, or it could be you are building a script that needs to retrieve the date dynamically. Unfortunately there is no standard SQL that allows you to retrieve today&#8217;s [&#8230;]</p><p>The post <a href="https://www.1keydata.com/blog/todays-date-in-sql.html">Today&#8217;s Date in SQL</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></description>
										<content:encoded><![CDATA[
<p>One use case that happens often in SQL is the need to retrieve today&#8217;s date. This could be you are doing an analysis based on recent data, or it could be you are building a script that needs to retrieve the date dynamically. </p>



<p>Unfortunately there is no standard SQL that allows you to retrieve today&#8217;s date across different database systems. So in this post we have gathered the SQL statement needed to retrieve today&#8217;s date for the most popular database systems:</p>



<p><u>Oracle</u></p>



<p><code>SELECT SYSDATE FROM DUAL;</code></p>



<p><u>SQL Server</u></p>



<p><code>SELECT GETDATE();</code></p>



<p><u>MySQL</u></p>



<p><code>SELECT CURDATE();</code></p>



<p><u>DB2</u></p>



<p><code>SELECT current date FROM sysibm.sysdummy1;</code></p>



<p><u>Hive</u></p>



<p><code>SELECT CURRENT_DATE;</code></p>



<p><u>SparkSQL</u></p>



<p><code>SELECT CURRENT_DATE or SELECT CURRENT_DATE();</code></p>



<p><u>BigQuery</u></p>



<p><code>SELECT CURRENT_DATE;</code></p>



<p><u>PostgreSQL</u></p>



<p><code>SELECT CURRENT_DATE;</code></p>



<p><u>SQLite</u></p>



<p><code>SELECT DATE();</code></p>
<p>The post <a href="https://www.1keydata.com/blog/todays-date-in-sql.html">Today&#8217;s Date in SQL</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Can You Have Multiple WHERE Clauses in SQL</title>
		<link>https://www.1keydata.com/blog/can-you-have-multiple-where-clauses-in-sql.html</link>
		
		<dc:creator><![CDATA[topcat]]></dc:creator>
		<pubDate>Sat, 04 Jun 2022 07:48:58 +0000</pubDate>
				<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">https://www.1keydata.com/blog/?p=1335</guid>

					<description><![CDATA[<p>Technically the answer is yes, it is possible to have multiple WHERE clauses in a SQL statement. For example, if you are using a subquery, you can certainly employ a WHERE clause within the subquery, and then again in the outer query. Another example is when you are combining two SQL statements with a UNION [&#8230;]</p><p>The post <a href="https://www.1keydata.com/blog/can-you-have-multiple-where-clauses-in-sql.html">Can You Have Multiple WHERE Clauses in SQL</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></description>
										<content:encoded><![CDATA[
<p>Technically the answer is yes, it is possible to have multiple <strong>WHERE</strong> clauses in a SQL statement. For example, if you are using a subquery, you can certainly employ a <strong>WHERE</strong> clause within the subquery, and then again in the outer query. Another example is when you are combining two SQL statements with a <strong>UNION</strong> / <strong>UNION ALL</strong> / <strong>INTERSECT</strong> / <strong>MINUS</strong>. In this case, both SQL statements can have their own <strong>WHERE </strong>clause.</p>



<span id="more-1335"></span>



<p>However, notice in each of those cases there are also multiple <strong>SELECT</strong> statements as well, and each <strong>WHERE</strong> is associated with a single <strong>SELECT</strong>. In fact, in a <strong>SELECT</strong> statement, there can only be a single <strong>WHERE</strong> clause. This also applies to <strong>DELETE</strong> and <strong>UPDATE</strong> statements as well.</p>



<p>Usually when people ask this question, though, the concern is not really whether it&#8217;s possible to have multiple <strong>WHERE</strong> clauses in a SQL statement, but whether it&#8217;s possible to specify multiple conditions in a SQL statement. The answer to this question is yes. You would do this using a single <strong>WHERE</strong> statement. Assuming there are two conditions and you want both of them to be true, you can use <strong>AND</strong> to connect the two conditions. If you want either one of them to be true, you can use <strong>OR</strong>.</p>



<p>While it is possible to use a subquery with multiple <strong>WHERE</strong> clauses to specify multiple conditions,</p>



<p style="background-color:#CCCCCC; padding-left:5px; padding-top:5px; padding-bottom:5px;"><code>SELECT * FROM<br>(SELECT * FROM SALES_TABLE<br>WHERE REGION = 'EAST')<br>WHERE YEAR = 2021<br>-- This query has two WHERE clauses</code></p>



<p>this is not an efficient query to use. A better way to achieve the same result is as follows:</p>



<p style="background-color:#CCCCCC; padding-left:5px; padding-top:5px; padding-bottom:5px;"><code>SELECT * FROM SALES_TABLE<br>WHERE REGION = 'EAST' and YEAR = 2021;</code></p>



<p></p>
<p>The post <a href="https://www.1keydata.com/blog/can-you-have-multiple-where-clauses-in-sql.html">Can You Have Multiple WHERE Clauses in SQL</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>What does WHERE 1=1 mean in SQL</title>
		<link>https://www.1keydata.com/blog/what-does-where-1-equals-to-1-mean-in-sql.html</link>
		
		<dc:creator><![CDATA[topcat]]></dc:creator>
		<pubDate>Mon, 30 May 2022 19:00:48 +0000</pubDate>
				<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">https://www.1keydata.com/blog/?p=1311</guid>

					<description><![CDATA[<p>Sometimes when you look at other people’s SQL code, you’ll see  WHERE 1=1 as part of the code. If you haven’t seen this before, you might be wondering why people do this. After all, 1=1 always evaluates to TRUE, so that apparently makes this line of code redundant. As it turns out, there are two [&#8230;]</p><p>The post <a href="https://www.1keydata.com/blog/what-does-where-1-equals-to-1-mean-in-sql.html">What does WHERE 1=1 mean in SQL</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></description>
										<content:encoded><![CDATA[
<p>Sometimes when you look at other people’s SQL code, you’ll see </p>



<p style="background-color:#CCCCCC; padding-left:5px;"><code>WHERE 1=1</code></p>



<p>as part of the code. If you haven’t seen this before, you might be wondering why people do this. After all, 1=1 always evaluates to TRUE, so that apparently makes this line of code redundant. As it turns out, there are two reasons why this is done:</p>



<p>Reason 1: Testing</p>



<span id="more-1311"></span>



<p>The first reason is to make it easy to test SQL statements. When a developer is working on building a SQL statement, often there is a lot of trial and error that happens. By having the <code>WHERE 1=1</code> clause, this makes the testing of the different <a href="https://www.1keydata.com/sql/sqlwhere.html">WHERE</a> conditions easier. </p>



<p style="background-color:#CCCCCC; padding-left:5px;"><code>WHERE 1=1<br>--and gender='F'<br>and product_id=135209<br>--and credit_card='Visa'</code></p>



<p>By having each condition on a different line, it’s easy to <a rel="noreferrer noopener" href="https://www.1keydata.com/sql/comment.html" target="_blank">comment out</a> different conditions using two dashes to explore the various possibilities.</p>



<p>Reason 2: Programmatic&nbsp;</p>



<p>The second use case for using <code>WHERE 1=1</code> is when you want to general SQL in a programmatic fashion. For example, you might have a selection box for users to select what category of product they want to view. In SQL, this will be implemented as part of the WHERE clause. If the code already has </p>



<p style="background-color:#CCCCCC; padding-left:5px;"><code>WHERE 1=1</code></p>



<p>then the program will only need to add an additional “AND [new condition]” clause after this, and not have to worry about putting in logic to determine whether this is the first condition that needs to be added (i.e., need to add the WHERE clause) or there is already a WHERE clause and you simply need to add an AND clause. </p>



<p>We’ve talked about two reasons, and we will also mention one supposed reason that actually isn’t true. Some people believe that <code>WHERE 1=1</code> will speed up the performance of the SQL query. This is not the case, as modern SQL optimizers simply ignore this clause.</p>



<p>Personally I do not put in <code>WHERE 1=1</code> in my SQL because to me this requires an extra effort and accomplishes no real goal. On the other hand we all have our programming habits, so there are occasions when I see a code that contains <code>WHERE 1=1</code>. When I get this, I simply leave it there for the same reason (there is no real benefit in taking the time to change it). </p>



<p>So next time you see <code>WHERE 1=1</code>, you understand why people use it. Whether you decide to adopt this pattern is entirely up to you. </p>
<p>The post <a href="https://www.1keydata.com/blog/what-does-where-1-equals-to-1-mean-in-sql.html">What does WHERE 1=1 mean in SQL</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Install a database on Windows PC</title>
		<link>https://www.1keydata.com/blog/install-database-windows-pc.html</link>
		
		<dc:creator><![CDATA[topcat]]></dc:creator>
		<pubDate>Thu, 24 Feb 2022 06:40:06 +0000</pubDate>
				<category><![CDATA[How To]]></category>
		<guid isPermaLink="false">https://www.1keydata.com/blog/?p=1292</guid>

					<description><![CDATA[<p>You are inspired by the SQL tutorial and you decided you want to install a database on your Windows PC. So, you do a Google search to see how this is done. Then you realize that there is a large variety of relational databases you can install. Not only that, as you browse through the [&#8230;]</p><p>The post <a href="https://www.1keydata.com/blog/install-database-windows-pc.html">Install a database on Windows PC</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>You are inspired by the SQL tutorial and you decided you want to install a database on your Windows PC. So, you do a Google search to see how this is done. Then you realize that there is a large variety of relational databases you can install. Not only that, as you browse through the different pages, you find the installation instructions for all of them are complicated. First you need to figure out which version you should download and install, then you have to go through multiple pages to find the right instructions. Pretty soon you realized that installing a database on your PC feels like a major project in itself.</p>
<p>This blog shows a simpler way. Assuming your goal is simply to have a database so you can practice your SQL skills, my recommendation is to go with SQLite3 for its ease of installation, its ease of use, and its small storage requirements. One thing to note with SQLite3 is that it does not have all the SQL features (here is <a href="https://www.sqlite.org/omitted.html" target="_blank">a short list of common SQL features not available in SQLite3</a>). Having said that, the truly important features are included.</p>
<p><span id="more-1292"></span>There are two ways to install SQLite3: The first is to install download and install directly from SQLite&#8217;s official website, the second is to install via the Anaconda package. Either method works, and we&#8217;ll provide instructions for doing both below.</p>
<h2>Download from SQLite&#8217;s official website</h2>
<p>Step 1: Go to SQLite&#8217;s official download page at <a href="https://sqlite.org/download.html" target="_blank">https://sqlite.org/download.html</a>.</p>
<p>Step 2: Click on the file that starts with sqlite-tools-win32 to download it to your machine (highlighted in red below).</p>
<p><img alt="SQLite download page" src="https://www.1keydata.com/blog/imgs/sqlite-download.jpg" /></p>
<p>Step 3: Create a new directory on your drive. If you want the files to reside in C:\sqlite3, navigate to C:\ using Command Prompt, then type in &#8220;mkdir sqlite3&#8221;.</p>
<p>Step 4: Double click on the downloaded ZIP file, then extract all the files into the C:\sqlite3 directory (or the directory you specified). There are three files, and all three of them combined require about 3 MB of space.</p>
<p>Step 5: Now the installation is complete. To run SQLite3, open Command Prompt, navigate to C:\sqlite3, and enter &#8220;sqlite3&#8221; to get into the user interface.</p>
<h2>Use the Anaconda distribution</h2>
<p>Step 1: SQLite3 is part of the Anaconda distribution. Anaconda bills itself as the &#8220;data science toolkit&#8221; and is primarily a distribution of Python and R. At the same time, it includes SQLite3 as a lightweight database. Go to <a href="https://www.anaconda.com/products/individual" target="_blank">Anaconda site</a> and download the Anaconda distribution.</p>
<p>Step 2: Double click on the Anaconda download to start the installation.</p>
<p>Step 3: Follow the prompts. You can safely select the default value when prompted.</p>
<p>Step 4: Once installation is completed, you can start using SQLite3. To get to SQLite3, start with the Windows prompt at the lower left hand side of your screen, go to Anaconda3 (64-bit), then Anaconda Prompt (see image below). </p>
<p><img alt="Anaconda Prompt" src="https://www.1keydata.com/blog/imgs/anaconda-prompt.jpg" /></p>
<p>Step 5: A window that looks similar to Command Prompt will show up. Type in &#8220;sqlite3&#8221;, and you are inside the database. Now you can practice your SQL. </p>
<p>As an alternative, you can also use the Command Prompt. However in this case you&#8217;ll need to navigate to the exact path where the SQLite.exe file is located. On my machine this is &#8220;C:\Users\C\Anaconda3\envs\new\Library\bin&#8221;. Since this is more troublesome to get to compared to just simply using the Anaconda Prompt, I recommend using the Anaconda Prompt.</p>
<p>Note that when you just type in &#8220;sqlite3&#8221; (after either installation method), you&#8217;ll get a message saying &#8220;Connected to a transient in-memory database.&#8221; This means whatever you store in the database will disappear when you exit. To connect to a physical database, type in the database name after &#8220;sqlite3.&#8221; For example, if your database name is &#8220;flower,&#8221; you&#8217;ll want to type &#8220;sqlite3 flower.db&#8221; and you&#8217;ll be connected to the flower database.</p>
<p>The post <a href="https://www.1keydata.com/blog/install-database-windows-pc.html">Install a database on Windows PC</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Prepare For a SQL Interview</title>
		<link>https://www.1keydata.com/blog/prepare-for-sql-interview.html</link>
		
		<dc:creator><![CDATA[topcat]]></dc:creator>
		<pubDate>Sun, 20 Feb 2022 19:49:21 +0000</pubDate>
				<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">https://www.1keydata.com/blog/?p=1272</guid>

					<description><![CDATA[<p>For data-related roles such as data scientists or data analysts, one of the interviews will inevitably be on SQL. This makes sense because SQL is what you use to extract data from databases, and as such is considered as an important fundamental skill set for the role. One question people generally ask is, &#8220;How do [&#8230;]</p><p>The post <a href="https://www.1keydata.com/blog/prepare-for-sql-interview.html">Prepare For a SQL Interview</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>For data-related roles such as data scientists or data analysts, one of the interviews will inevitably be on SQL. This makes sense because SQL is what you use to extract data from databases, and as such is considered as an important fundamental skill set for the role.</p>
<p>One question people generally ask is, &#8220;How do I prepare for a SQL interview?&#8221; Here we will provide the answer to that question. We&#8217;ll start of with the general format of a SQL interview, then go into how to prepare for the interview, and finally we provide a few tips on what to do during the actual interview.</p>
<h2>General format</h2>
<p>In a SQL interview, the first five minutes or so will be spent on doing introductions. For this part, you should have a short script ready (no more than two minutes) that goes into your background and why you are interested in the role.</p>
<p><span id="more-1272"></span>After that, the interviewer will dive into the questions. You should expect to answer multiple questions. This can be in the form of a single large question with multiple parts (i.e., the first part is easy, followed by parts with increasing difficulty), or it could be several questions that are unrelated to one another.</p>
<p>Often questions are related to the industry the company is in. For example, if you are interviewing with a social networking company, expect the questions to be related to social networking.</p>
<p>Usually the interview will be conducted over an online coding tool such as Coderpad or CodeSignal. Once you receive the question, you will then code your SQL in the tool. The interviewers will be logged into the same tool and can see in real time what you are typing in. Sometimes you can run the code to see if you get the right answer, but more often the interviewer will just be looking at your code to determine its quality. It is important to note that in the vast majority of the cases, the interviewer does not care about what flavor of SQL you use.</p>
<h2>How to prepare</h2>
<p>You&#8217;ll want to brush up on the following:</p>
<ul>
<li><a href="https://www.1keydata.com/sql/sqlfunctions.html">Aggregate functions</a> and <a href="https://www.1keydata.com/sql/sqlgroupby.html">group by</a></li>
<li><a href="https://www.1keydata.com/sql/sqlfunctions.html">Join</a> (when to use <a href="https://www.1keydata.com/sql/sql-outer-join.html">outer join</a>)</li>
<li><a href="https://www.1keydata.com/sql/sqlunion.html">Union</a>: A good number of questions will require you to answer in parts and then combine the results at the end. This is where UNION becomes handy.</li>
<li><a href="https://www.1keydata.com/sql/sql-window-functions.html">Window functions</a>: Inevitably you&#8217;ll run into a problem that requires you use Window functions to solve.</li>
<li>How the company works. This is useful because the SQL questions are usually related to the company itself. Understand how the company works can allow you to understand the question faster.</li>
</ul>
<p>Get plenty of rest the night prior to the interview, and schedule your day of the interview so you are refresh for the interview. While this is true for all interviews, it is especially so for a SQL (or any other coding) interview because you are expected to be able to think on your feet, and a fresh mind gives you the best chance to be successful doing that.</p>
<p>There are also areas that you do NOT need to prepare for. Note that I have never seen the following topics:</p>
<ul>
<li><a href="https://www.1keydata.com/sql/sql-string-functions.html">String functions</a></li>
<li><a href="https://www.1keydata.com/sql/sql-date-functions.html">Date functions</a></li>
<li>Anything related to <a href="https://www.1keydata.com/sql/sql-null.html">NULL</a></li>
<li>Any of the &#8220;SQL background&#8221; type of questions such as &#8220;What is RDBMS?&#8221; or &#8220;What is SQL&#8221;?</li>
</ul>
<p>I suspect that you don&#8217;t see the first three types because they are often database-dependent, and interviewers are usually interested in your general SQL skills, not in how good you are with a particular flavor of SQL.</p>
<p>For the &#8220;SQL background&#8221; type questions, you&#8217;ll often see those questions listed in the top results when you Google &#8220;SQL interview questions&#8221;, but in reality you never get them &#8212; interviewers are interested in how you can use SQL to solve problems, not whether you know SQL stands for Structured Query Language.</p>
<h2>Interview Tips</h2>
<p>You are prepared for the interview. Below are six tips for you to pass your interview:</p>
<p>1. <b>Ask for clarifications</b>. If there is anything in the interview question you are unsure of, make sure you ask the interviewer for clarification as opposed to make assumptions yourself. This is especially important if the question is domain-specific and you are not familiar with the domain.</p>
<p>2. <b>Break down the question</b>. When you get a question, break it down, and write your code based on how you are breaking things down. I recommend that you use <a href="https://www.1keydata.com/sql/sql-with.html">WITH</a> clauses to componentize your code. While it is possible to use subqueries for this purpose, I find using the with clauses to be easier for the interviewee to proceed and for the interviewer to follow.</p>
<p>3. <b>Look at the instructions carefully</b>. The reason is you don&#8217;t want to miss out on any filtering conditions. Did the question ask for only a particular time period? Did the question ask for top 10 overall or top 10 by country? These are details that the interviewer will pay attention to.</p>
<p>4. <b>Talk out loud</b>. Let the interviewer know your thought process. This makes it easy for the interviewer to follow your train of thought. And in case you are stuck or is going down the wrong path, the interviewer can guide you in the right direction.</p>
<p>5. <b>Perfection is not necessary</b>. If you have an idea on how to do something but at the same time you know it&#8217;s not the best way to proceed (and you don&#8217;t know what that &#8220;better way&#8221; is right at that moment), you should nevertheless go with the answer you know. Once you have something that works, the interviewer may ask (or you might want to mention yourself) that there could be a better way. The extra time you&#8217;ve bought for yourself may allow you to come up with the more elegant answer.</p>
<p>6. <b>Ask for help</b>. If you are really stuck, don&#8217;t be afraid to ask for help. Nothing is more awkward than a long silence. In most cases, the fact that you asked for help doesn&#8217;t mean that you have failed the interview. In fact, some questions are designed so that the interviewer expects the interviewee to struggle. As long as you can proceed to the right answer after the interviewer provides a hint, you should still be okay.</p>
<h2>Summary</h2>
<p>A technical SQL interview can be daunting, even for people who have used SQL for a while. By following the tips in this post on how to prepare and how to answer questions, you should be able to pass your SQL interview in flying colors.</p>
<p>The post <a href="https://www.1keydata.com/blog/prepare-for-sql-interview.html">Prepare For a SQL Interview</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Change Blog &#8220;Posted On&#8221; Date To &#8220;Last Updated On&#8221; Date in WordPress</title>
		<link>https://www.1keydata.com/blog/wordpress-change-posted-to-last-updated.html</link>
		
		<dc:creator><![CDATA[topcat]]></dc:creator>
		<pubDate>Mon, 03 Oct 2016 04:24:03 +0000</pubDate>
				<category><![CDATA[Wordpress Tips]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">http://www.1keydata.com/blog/?p=1137</guid>

					<description><![CDATA[<p>Over the years you may have published a large number of blog posts. If there are posts that are more than three years old, you may find that some of the content on those old posts is no longer valid and needs to be updated. On WordPress, you can do this easily. All you need [&#8230;]</p><p>The post <a href="https://www.1keydata.com/blog/wordpress-change-posted-to-last-updated.html">Change Blog &#8220;Posted On&#8221; Date To &#8220;Last Updated On&#8221; Date in WordPress</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Over the years you may have published a large number of blog posts.</p>
<p>If there are posts that are more than three years old, you may find that some of the content on those old posts is no longer valid and needs to be updated.</p>
<p>On WordPress, you can do this easily. All you need to do is to go into the &#8220;Edit Post&#8221; mode in WordPress, change your content, and hit &#8220;Update&#8221; to have the new content show up.</p>
<p>The problem with this approach is that WordPress still shows the original post date to the readers. This is usually not what we want because users may look at the old date and quickly assume that the information contained there is out of date, and that is exactly the opposite of what we want.</p>
<p><span id="more-1137"></span>What we want to do is to update the publish date to the most recent date it is published, and change the WordPress code so that it shows the &#8220;Last Updated On&#8221; date instead of the &#8220;Posted On&#8221; date. This way, not only will users see that the post is recent, but it will also bring the blog post up to the top of your home page so it gets more attention from your readers.</p>
<p>There are two things you need to do:<br />
1. Change the &#8220;Published On&#8221; field on your Edit screen. You need to do this for each post you update.<br />
2. Modify the PHP code of the theme you are using so that it shows &#8220;Last Updated On&#8221; instead of &#8220;Published On.&#8221; You&#8217;ll only need to do this once.</p>
<h2>Change the &#8220;Publish On&#8221; field on your Edit screen</h2>
<p>This is a fairly easy thing to do. On the upper right-hand corner in the &#8220;Edit Post&#8221; mode, you&#8217;ll find the publish timestamp in a drop down box (see figure below).</p>
<p><img alt="Publish Panel in WordPress" src="imgs/wordpress-publish-panel.jpg" width="300" border="0" /></p>
<p>Click on the &#8220;Edit&#8221; link (highlighted in red), and you will see five drop-down boxes that allow you to change the year, month, date, hour, and minute of the post date.</p>
<p><img alt="Edit Published On Date in WordPress" src="imgs/wordpress-publish-panel-edit-published-on-date.jpg" width="300" border="0" /></p>
<p>Make the appropriate changes and click the &#8220;OK&#8221; button. Now the Post Date of the blog entry will be changed to what you just specified.</p>
<h2>Modify the PHP code</h2>
<p>Changing the PHP code? This may sound terrifying if you are not a PHP programmer, but you should not worry because you will not be altering any functionality. What you&#8217;ll be changing is simply the text output of your PHP code.</p>
<p>You can modify the PHP code directly in the WordPress Dashboard. The steps are as follows:</p>
<p>1. Login to your WordPress Dashboard.<br />
2. Click on &#8220;Appearance&#8221; on the left navigation.<br />
3. Click on &#8220;Editor&#8221; in the sub-menu that shows up under &#8220;Appearance.&#8221;<br />
4. On the right, click on &#8220;template-tags.php.&#8221;<br />
5. Change &#8220;Posted On&#8221; to &#8220;Last Updated On&#8221; in the text box (see image below).<br />
6. Click &#8220;Update File&#8221; to save the change.</p>
<p><img alt="Change to Last updated On in WordPress Editor" src="imgs/wordpress-change-posted-on-to-last-updated-on.jpg" width="600" border="0" /></p>
<p>Now your post will have a &#8220;Last Updated&#8221; date instead of &#8220;Posted&#8221; date.</p>
<p>Please note that the location of this code may be in different places depending on the particular theme your blog uses. If your theme does not have the &#8220;template-tags.php&#8221; file or if that file does not contain what you are looking for, try looking for it in other files.</p>
<p>If you have shell access to your hosting environment, you can edit the relevant file directly.</p>
<p>The post <a href="https://www.1keydata.com/blog/wordpress-change-posted-to-last-updated.html">Change Blog &#8220;Posted On&#8221; Date To &#8220;Last Updated On&#8221; Date in WordPress</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Composite Key In SQL</title>
		<link>https://www.1keydata.com/blog/composite-key-in-sql.html</link>
		
		<dc:creator><![CDATA[topcat]]></dc:creator>
		<pubDate>Wed, 28 Sep 2016 04:00:39 +0000</pubDate>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[composite key]]></category>
		<category><![CDATA[composite primary key]]></category>
		<category><![CDATA[primary key]]></category>
		<guid isPermaLink="false">http://www.1keydata.com/blog/?p=616</guid>

					<description><![CDATA[<p>Discusses the concept of composite key in SQL, and shows examples of creating a composite key in MySQL, Oracle, and SQL Server.</p><p>The post <a href="https://www.1keydata.com/blog/composite-key-in-sql.html">Composite Key In SQL</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Composite key, or composite primary key, refers to cases where more than one column is used to specify the primary key of a table. In such cases, all foreign keys will also need to include all the columns in the composite key. Note that the columns that make up a composite key can be of different data types.</p>
<p>Below is the SQL syntax for specifying a composite key:</p>
<p><span id="more-616"></span>CREATE TABLE TABLE_NAME<br />
(COLUMN_1 DATA_TYPE_1,<br />
COLUMN_2 DATA_TYPE_2,<br />
&#8230;<br />
PRIMARY KEY (COLUMN_1, COLUMN_2, &#8230;));</p>
<p>Some database-specific examples are shown below.  In all cases the composite key created consists of COL1 and COL2.</p>
<h3>MySQL</h3>
<p>CREATE TABLE SAMPLE_TABLE<br />
(COL1 integer,<br />
COL2 varchar(30),<br />
COL3 varchar(50),<br />
PRIMARY KEY (COL1, COL2));</p>
<h3>Oracle</h3>
<p>CREATE TABLE SAMPLE_TABLE<br />
(COL1 integer,<br />
COL2 varchar(30),<br />
COL3 varchar(50),<br />
PRIMARY KEY (COL1, COL2));</p>
<h3>SQL Server</h3>
<p>CREATE TABLE SAMPLE_TABLE<br />
(COL1 integer,<br />
COL2 nvarchar(30),<br />
COL3 nvarchar(50),<br />
PRIMARY KEY (COL1, COL2));</p>
<h3>Composite Key Example</h3>
<p>An example is when we want to record the history of student class registration and grade history. For this, we want to record which student took what class during what quarter, along with the date of registration, date of drop (if the class was dropped), and the final grade. Our table will look like the following:</p>
<p>Table <i><b>Class_History</b></i></p>
<table border=1>
<tr>
<td>Quarter_ID</td>
</tr>
<tr>
<td>Student_ID</td>
</tr>
<tr>
<td>Course_ID</td>
</tr>
<tr>
<td>Date_Registered</font></tr>
<tr>
<td>Date_Dropped</td>
</tr>
<tr>
<td>Final_Grade</td>
</tr>
</table>
<p>In this table, <b>the first three fields, Quarter_ID, Student_ID, Course_ID, together form a composite key.</b> Each of them individually cannot uniquely identify each record, but together the combination of all three does uniquely identify each record.</p>
<p>The post <a href="https://www.1keydata.com/blog/composite-key-in-sql.html">Composite Key In SQL</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Migrating From HTTPS To HTTP</title>
		<link>https://www.1keydata.com/blog/migrating-https-to-http.html</link>
		
		<dc:creator><![CDATA[topcat]]></dc:creator>
		<pubDate>Sun, 17 Jul 2016 03:50:15 +0000</pubDate>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">http://www.1keydata.com/blog/?p=1098</guid>

					<description><![CDATA[<p>Why Migrate From HTTPS To HTTP While moving from HTTP to HTTPS is a growing trend, there may be a time when you want to convert HTTPS to HTTP. For us, the main driver was page load time. After we migrated to HTTPS, the average page load time went up substantially, thus negatively impacting user [&#8230;]</p><p>The post <a href="https://www.1keydata.com/blog/migrating-https-to-http.html">Migrating From HTTPS To HTTP</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><img alt="HTTPS to HTTP" src="https://www.1keydata.com/images/https-to-http.jpg" /></p>
<h2>Why Migrate From HTTPS To HTTP</h2>
<p>While moving from HTTP to HTTPS is a growing trend, there may be a time when you want to convert HTTPS to HTTP. For us, the main driver was page load time. After we migrated to HTTPS, the average page load time went up substantially, thus negatively impacting user experience. We tried several methods to improve page load time, but found little success. As a result, we decided reverting to HTTP was the best way to proceed.</p>
<h2>Do I Still Need an SSL Certificate After Migrating From HTTPS To HTTP?</h2>
<p><span id="more-1098"></span>It is important to note that even after you migrate from HTTPS to HTTP, you&#8217;ll still need a valid SSL certificate. This is because since the initial request will come via HTTPS, you&#8217;ll still need to have a valid certificate. Otherwise, your visitors will see a &#8220;your connection is not secure&#8221; type of error, which is enough to turn most of them away before they even see anything on your site.</p>
<h2>How To Migrate From HTTPS To HTTP</h2>
<p>The amount of work required to convert HTTPS to HTTP is actually fairly small. The steps are below. In this post, the commands we use are for Apache 2.4.18 / Ubuntu. If you use a different web server / OS combination, please make sure you use the appropriate command.</p>
<p><b>1. Set up a redirect to point your HTTPS pages to HTTP pages.</b> To do this, modify the Apache2 config file for your domain under /etc/apache2/sites-available/. Add the following line under &lt;Virtualhost *.443&gt;:</p>
<div style="background: #CCC; padding: 10px;">Redirect Permanent / http://your-site-name.com</div>
<p>Remember to replace your-site-name.com with your own domain name.</p>
<p><b>2. Remove the HTTP to HTTPS redirect you may have set up when you went to HTTPS.</b> This will not apply if you set up your site initially with HTTPS. In our existing configuration, that means we needed to remove the redirect under &lt;Virtualhost *:80&gt;. This will look something like the following:</p>
<div style="background: #CCC; padding: 10px;">Redirect Permanent / https://your-site-name.com</div>
<p>You should remove that line.</p>
<p><b>3. In Apache, change the Virtualhost directive for your HTTPS port.</b> To do this, change</p>
<p>&lt;Virtualhost *:443&gt;</p>
<p>into</p>
<p>&lt;Virtualhost your-site-name.com:443&gt;</p>
<p>If you don&#8217;t do this step, your visitors will see an infinite redirect loop and your page never loads.</p>
<p><b>4. Restart the web server.</b> In our configuration, this is done by the following command:</p>
<div style="background: #CCC; padding: 10px;">service apache2 restart</div>
<p>Depending on your OS and Web Server, the command to restart the web server may be different.</p>
<p><b>Once you have completed the above steps, you have successfully migrated from HTTPS to HTTP.</b> The caveat is that the client browser must not already have a cached version of you page. If your page is already cached, your visitors will see an infinite redirect loop. There are two ways to resolve this:</p>
<p>a. The visitor has to manually clear the browser cache. In fact, before you can test your own changes, You&#8217;ll need to manually clear the browser cache. If you do not, you&#8217;ll see an infinite redirect loop even if your setting changes were correct.</p>
<p>b. Use a different URL for your pages. This approach will ensure that the HTTP version loads. This approach has two disadvantages: First, the amount of effort to set up the appropriate redirects may be large. Second, changing URL&#8217;s may impact your site&#8217;s SEO traffic negatively. I do not recommend this approach if you have a large number of pages or already have a significant amount of traffic from search engines.</p>
<p>I looked into ways to force browsers to clear cache from the server side, but found that this is not possible, even when I modified the Header information. This means that, after you complete your HTTPS to HTTP migration, there will be a subset of your visitors who will have difficulties accessing your site, and that number can be substantial if you have a high percentage of return visitors. You&#8217;ll then need to weigh the relative impact of losing repeat traffic and the benefit of changing to HTTP before proceeding.</p>
<p><b>5. Update all your internal and external links.</b> Technically the migration of your site from HTTPS to HTTP is complete if you executed steps 1-4 above, as all HTTPS calls will be redirected to their HTTP counterpart. However, you should still convert all the internal links that are HTTPS (don&#8217;t forget to update your non-relative links and your canonical URL) and all external links that are HTTPS (for example, update all your social profile links). That way, you preserve your web server resources by saving an unnecessary call.</p>
<p>The post <a href="https://www.1keydata.com/blog/migrating-https-to-http.html">Migrating From HTTPS To HTTP</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WebPageTest Error With HTTPS / HTTP2 Enabled Site</title>
		<link>https://www.1keydata.com/blog/webpagetest-error-https-http2-enabled-site.html</link>
		
		<dc:creator><![CDATA[topcat]]></dc:creator>
		<pubDate>Sat, 02 Apr 2016 20:22:14 +0000</pubDate>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ERR_SPDY_INADEQUATE_TRANSPORT_SECURITY]]></category>
		<category><![CDATA[gtmetrix]]></category>
		<category><![CDATA[http2]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[sslciphersuite]]></category>
		<category><![CDATA[webpagetest]]></category>
		<guid isPermaLink="false">https://www.1keydata.com/blog/?p=1060</guid>

					<description><![CDATA[<p>Symptoms One situation I ran into when I migrated 1keydata.com to HTTPS with HTTP2 enabled was that I had an issue with the page load speed testing tools WebPageTest and GTMetrix. On both tools, https://www.1keydata.com/ failed to load, yet when I visit the site using a browser, the website loaded up fine. This is the [&#8230;]</p><p>The post <a href="https://www.1keydata.com/blog/webpagetest-error-https-http2-enabled-site.html">WebPageTest Error With HTTPS / HTTP2 Enabled Site</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></description>
										<content:encoded><![CDATA[<h3>Symptoms</h3>
<p>One situation I ran into when I migrated 1keydata.com to HTTPS with HTTP2 enabled was that I had an issue with the page load speed testing tools WebPageTest and GTMetrix. On both tools, https://www.1keydata.com/ failed to load, yet when I visit the site using a browser, the website loaded up fine. This is the first time I have seen a difference in behavior between these types of testing tools and a browser. Given the highly unusual nature of this difference, I decided to look into the issue further. Below is what the test result page on WebPageTest looked like:</p>
<p><img alt="WebPageTest Error Result Page" src="https://www.1keydata.com/images/webpagetest-error-result.jpg" width="550" /></p>
<p><span id="more-1060"></span>On the other hand, when I switch the user agent on WebPageTest to IE, the page test loaded fine. Also, it&#8217;s worth noting that the site itself renders fine in a browser. The only thing that appears strange was that sometimes at the beginning of a page load, I would see a screen showing up temporarily before the actual page loads on Chrome. In all cases, though, the web page proceeded to load correctly, so initially I didn&#8217;t think much of this issue. During the course of my investigation, though, I decided to look into this as it may be related to the issue I was seeing. Using a screen video capture software, I was able to capture what that temporary page looks like:</p>
<p><img alt="ERR_SPDY_INADEQUATE_TRANSPORT_SECURITY Error Page" src="https://www.1keydata.com/images/err_spdy_inadequate_transport_security.jpg" width="500" /></p>
<p>The error message that showed up was ERR_SPDY_INADEQUATE_TRANSPORT_SECURITY.</p>
<h3>Synopsis</h3>
<p>It turned out that the issue was with the SSL Cipher Suite that was set up on the server. Below is part of the screenshot from the SSLTest result for https://www.1keydata.com/:</p>
<p><img alt="" src="https://www.1keydata.com/images/ssltest-http2-blacklist.jpg" width="550" /></p>
<p>Notice the &#8220;Server negotiated HTTP/2 with blacklisted suite&#8221; message. The specific SSL Cipher Suite that was causing the issue was also listed: &#8220;TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA.&#8221;</p>
<h3>Resolution</h3>
<p>What&#8217;s happening here is the Chrome (and Firefox) is hitting a blacklisted SSL Cipher Suite when it is trying to connect via HTTP2. This only happens if HTTP2 is configured for the website. The resolution is to set up the Apache server in a way so that an acceptable SSL Cipher Suite that is not on the blacklist is called by Chrome/Firefox *before* the blacklisted SSL Cipher Suite. As it turned out, the order you use when you list the SSLCipherSuite items is important.</p>
<p>The fix for Apache 2.4.18 on Ubuntu 14.06 LTS is as follows:</p>
<p>Open your site configuration file</p>
<div style="background: #CCC; padding: 10px;">vi /etc/apache2/sites-available/example.com.conf</div>
<p>&nbsp;<br />
and insert &#8220;ECDHE-RSA-AES128-GCM-SHA256:&#8221; right in front of your SSLCipherSuite directive:</p>
<div style="background: #CCC; padding: 10px;">SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:[rest of your SSLCipherSuite list]</div>
<p>&nbsp;<br />
After this, restart your Apache server:</p>
<div style="background: #CCC; padding: 10px;">service apache2 restart</div>
<p>&nbsp;<br />
And now everything should be okay. Tests run on both WebPageTest and GTMetrix should complete without any problems. The temporary page with the ERR_SPDY_INADEQUATE_TRANSPORT_SECURITY error message should no longer exist.</p>
<p>Reference: <a href="http://sparanoid.com/note/http2-and-ecdsa-cipher-suites/">http://sparanoid.com/note/http2-and-ecdsa-cipher-suites/</a></p>
<p>The post <a href="https://www.1keydata.com/blog/webpagetest-error-https-http2-enabled-site.html">WebPageTest Error With HTTPS / HTTP2 Enabled Site</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>March 2016 Browser Market Share</title>
		<link>https://www.1keydata.com/blog/march-2016-browser-market-share.html</link>
		
		<dc:creator><![CDATA[topcat]]></dc:creator>
		<pubDate>Sat, 02 Apr 2016 17:09:47 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.1keydata.com/blog/?p=1057</guid>

					<description><![CDATA[<p>Here is the browser market share for March 2016, based on traffic to my top site (number in parentheses shows change from February 2016): Google Chrome: 65.29% (+1.14%) Firefox: 14.66% (-0.59%) IE: 12.76% (-0.50%) Safari: 3.42% (-0.05%) Edge: 1.05% (+0.06%) Google Chrome continued its strength in March, gaining 1.14% to 65.29%. The gain came at [&#8230;]</p><p>The post <a href="https://www.1keydata.com/blog/march-2016-browser-market-share.html">March 2016 Browser Market Share</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Here is the browser market share for March 2016, based on traffic to my top site (number in parentheses shows change from <a href="http://www.1keydata.com/blog/2016/03/february-2016-browser-market-share.html">February 2016</a>):</p>
<p>Google Chrome: 65.29% (+1.14%)<br />
Firefox: 14.66% (-0.59%)<br />
IE: 12.76% (-0.50%)<br />
Safari: 3.42% (-0.05%)<br />
Edge: 1.05% (+0.06%)</p>
<p><span id="more-1057"></span>Google Chrome continued its strength in March, gaining 1.14% to 65.29%. The gain came at the expense of Firefox, IE, and Safari, all of which saw its market share decline in March. If you think you have read this statement before, you are correct, because the same thing happened in February as well. Microsoft Edge finally broke 1% in March.</p>
<p>In March, Microsoft has finally started giving Edge the extension functionality&#8211;a functionality that likely has prompted most Windows 10 users to go to Chrome and Firefox. The number of extension is quite limited at this time, though it should grow over time. My impression is that, &#8220;it&#8217;s best late than never.&#8221; If Microsoft can manage to keep half of its new Windows 10 users on Edge because of the extension functionality, it will do a lot better than it is today, when only 12.51% of its Windows 10 users are using a Microsoft browser.</p>
<p>The post <a href="https://www.1keydata.com/blog/march-2016-browser-market-share.html">March 2016 Browser Market Share</a> appeared first on <a href="https://www.1keydata.com/blog">Technology Tips</a>.</p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
