<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>PostgreSQL on 我的绕地飞行记录</title>
    <link>https://blog.inith271.top/tags/postgresql/</link>
    <description>Recent content in PostgreSQL on 我的绕地飞行记录</description>
    <image>
      <title>我的绕地飞行记录</title>
      <url>https://blog.inith271.top/%3Clink%20or%20path%20of%20image%20for%20opengraph,%20twitter-cards%3E</url>
      <link>https://blog.inith271.top/%3Clink%20or%20path%20of%20image%20for%20opengraph,%20twitter-cards%3E</link>
    </image>
    <generator>Hugo -- 0.136.1</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 05 Nov 2024 10:25:22 +0800</lastBuildDate>
    <atom:link href="https://blog.inith271.top/tags/postgresql/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>PostgreSQL Quick Start I</title>
      <link>https://blog.inith271.top/posts/postgresql-quick-start-i/</link>
      <pubDate>Tue, 05 Nov 2024 10:25:22 +0800</pubDate>
      <guid>https://blog.inith271.top/posts/postgresql-quick-start-i/</guid>
      <description>&lt;h2 id=&#34;crud-quick-start&#34;&gt;CRUD Quick Start&lt;/h2&gt;
&lt;p&gt;use postgresql by super user prompt&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;connecting to database server by &lt;code&gt;psql -U postgres&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;starting sql with commandline&lt;/li&gt;
&lt;li&gt;creating a user &amp;lsquo;sunce&amp;rsquo; by &lt;code&gt;create user sunce with password &#39;sunce&#39;;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;creating a database &amp;lsquo;people&amp;rsquo; with owner &amp;lsquo;sunce&amp;rsquo; by &lt;code&gt;create database people with owner &#39;sunce&#39;;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;quit a session by &lt;code&gt;\q&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;now you got a database and a user.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;connecting to database &amp;lsquo;people&amp;rsquo; in user &amp;lsquo;sunce&amp;rsquo; by &lt;code&gt;psql people sunce&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;creating a table &amp;lsquo;users&amp;rsquo; by sql&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;create&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;table&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;users&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;	&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;name&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;varchar&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;128&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;	&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;email&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;varchar&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;128&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;list all table by &lt;code&gt;\dt&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;show the schema of the table &amp;lsquo;users&amp;rsquo; by &lt;code&gt;\d+ users&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;run sql from a file in the current directory by &lt;code&gt;\i lession.sql&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;quit to back into terminal by &lt;code&gt;\q&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;notie: connecting a database on remote server by &lt;code&gt;psql -h host -p port -U user database&lt;/code&gt;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
