You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.5 KiB
HTML
78 lines
2.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="description" content="Basic SQL cheatsheet for the commandline.">
|
|
<meta name="keywords" content="Blog, articles, guide, mysql, mariadb, database">
|
|
<meta name="author" content="Nathan (Aney) Steel">
|
|
<meta name="theme-color" content="white">
|
|
<meta name="theme-color" content="black">
|
|
<link rel="stylesheet" type="text/css" href="/main.css">
|
|
<link rel="icon" type="image/png" href="/images/favicon.svg">
|
|
<title>SQL Cheatsheet</title>
|
|
</head>
|
|
|
|
<body>
|
|
<header>
|
|
<h1>SQL Cheatsheet</h1>
|
|
<input id="burger-toggle" type="checkbox"/>
|
|
<label class="burger-container" for="burger-toggle"><div class="burger"></div></label>
|
|
<hr/>
|
|
<nav>
|
|
<a href="/">home</a>
|
|
<a href="/about.html">about</a>
|
|
<a href="/projects.html">projects</a>
|
|
<a href="/blog/">blog</a>
|
|
<a href="/sitemap.html">misc</a>
|
|
<a href="/support.html">support</a>
|
|
</nav>
|
|
<hr/>
|
|
</header>
|
|
|
|
<main>
|
|
<section>
|
|
<p>SQL is a great, simple to use language to manipulate data within a database. This cheatsheet is aimed at basic SQL for MySQL/MariaDB.</p>
|
|
|
|
<h2>Access on the command line</h2>
|
|
<pre><code>mysql -u <USERNAME> -p</code></pre>
|
|
<p>When prompted enter your password</p>
|
|
|
|
<h2>Database manipulation</h2>
|
|
<h3>Show databases</h3>
|
|
<pre><code>SHOW databases;</code></pre>
|
|
|
|
<h3>Create new databases</h3>
|
|
<pre><code>CREATE DATABASE IF NOT EXISTS <DATABASE>;</code></pre>
|
|
|
|
<h3>Enter into a database</h3>
|
|
<pre><code>USE DATABASE <DATABASE>;</code></pre>
|
|
<p>or just</p>
|
|
<pre><code>USE <DATABASE>;</code></pre>
|
|
|
|
<h2>Table manipulation</h2>
|
|
<p>Once you've got a database selected, you can play with tables</p>
|
|
<h3>Create</h3>
|
|
<h3>Read</h3>
|
|
<h3>Update</h3>
|
|
<h3>Delete</h3>
|
|
|
|
<h2>Data manipulation</h2>
|
|
<p>Most of your SQL life will be CRUDing (Create, Read, Update, Delete) data. So I'll cover the basics here</p>
|
|
<h3>Create</h3>
|
|
<h3>Read</h3>
|
|
<h3>Update</h3>
|
|
<h3>Delete</h3>
|
|
|
|
<h2>Create additional users</h2>
|
|
</section>
|
|
</main>
|
|
|
|
<footer>
|
|
<hr/>
|
|
<p>Written by <a href="http://aney.co.uk" target="_blank" rel="noopener">@aney</a> with <a href="https://danluu.com/web-bloat/" target="_blank" rel="noopener">web bloat</a> in mind | <a href="https://github.com/Aney/website" target="_blank" rel="noopener">Source Code</a></p>
|
|
</footer>
|
|
</body>
|
|
</html>
|
|
|