随笔分类 -  Postgres

摘要:Server wait for database get ready # From https://docs.docker.com/compose/startup-order/ #!/bin/sh # wait-for-postgres.sh set -e host="$1" shift # Log 阅读全文
posted @ 2023-02-05 00:37 Zhentiw 阅读(41) 评论(0) 推荐(0) 编辑
摘要:For examlpe, we have two tables: cars: make: For cars table, we want to know 'make_name' instead of 'make_id', we can do with 'join' two tables. In or 阅读全文
posted @ 2021-03-20 23:35 Zhentiw 阅读(48) 评论(0) 推荐(0) 编辑
摘要:Instead of first checking to see if a record already exists within your table, we can do a on conflict do update. In this command, we can ether insert 阅读全文
posted @ 2020-10-08 02:25 Zhentiw 阅读(162) 评论(0) 推荐(0) 编辑
摘要:SQL is dynamic enough to handle queries within queries. These inner queries are called subqueries and they can be used in many different sections of a 阅读全文
posted @ 2020-09-07 01:50 Zhentiw 阅读(171) 评论(0) 推荐(0) 编辑
摘要:SQL gives us the power to choose what data we pull out of our table. We will use the where clause within our select statement with many operators. The 阅读全文
posted @ 2020-09-02 03:37 Zhentiw 阅读(141) 评论(0) 推荐(0) 编辑
摘要:Another powerful SQL skill is understanding how to group rows together by column values. Once the data is grouped together, it can be difficult to und 阅读全文
posted @ 2020-08-31 23:53 Zhentiw 阅读(120) 评论(0) 推荐(0) 编辑
摘要:If the data in your tables do not have integrity, meaning there are missing rows, incorrect values, or duplicate rows, your table is not worth much. D 阅读全文
posted @ 2020-08-28 19:30 Zhentiw 阅读(145) 评论(0) 推荐(0) 编辑
摘要:Delete: delete from Users where last_name = 'clark'; If you wanted to delete everything in our table, I mentioned you could just use the delete comman 阅读全文
posted @ 2020-08-28 19:22 Zhentiw 阅读(143) 评论(0) 推荐(0) 编辑
摘要:PostgreSQL allows you store and compare UUID values but it does not include functions for generating the UUID values in its core. Instead, it relies o 阅读全文
posted @ 2020-08-28 18:41 Zhentiw 阅读(133) 评论(0) 推荐(0) 编辑
摘要:Install: brew install postgresql Start: brew services start postgresql psql postgres Create a table: $ postgres=# create table Users ( $ postgres(# cr 阅读全文
posted @ 2020-08-12 15:40 Zhentiw 阅读(140) 评论(0) 推荐(0) 编辑
摘要:When working with databases, it seems inevitable that you will find yourself needing to export data from a table to send along to another team, compan 阅读全文
posted @ 2020-07-30 15:12 Zhentiw 阅读(202) 评论(0) 推荐(0) 编辑
摘要:Every movie needs a director and every rented movie needs to exist in the store. How do we make sure something in another table exists before insertin 阅读全文
posted @ 2017-05-31 21:08 Zhentiw 阅读(175) 评论(0) 推荐(0) 编辑
摘要:Let’s say we have a bank. Our bank wants to give each account for each user a unique name, for instance, “Personal” or “Checking.” How can we make sur 阅读全文
posted @ 2017-05-31 21:03 Zhentiw 阅读(193) 评论(0) 推荐(0) 编辑
摘要:How can we see a histogram of movies on IMDB with a particular rating? Or how much movies grossed at the box office each month? Or how many movies the 阅读全文
posted @ 2017-03-10 19:17 Zhentiw 阅读(297) 评论(0) 推荐(0) 编辑
摘要:Delete example: Update example: 阅读全文
posted @ 2017-03-09 01:45 Zhentiw 阅读(201) 评论(0) 推荐(0) 编辑
摘要:We have all this data, but how do we answer questions about it? In this lesson we’ll learn how to filter down to just the information we’re looking fo 阅读全文
posted @ 2017-03-07 19:35 Zhentiw 阅读(155) 评论(0) 推荐(0) 编辑
摘要:// Insert one row INSERT INTO movies (title, release_date, count_stars, director_id) VALUES ( 'Kill Bill', '10-10-2003', 3, 1 ); // Insert multi rows INSERT INTO movies (title, release_... 阅读全文
posted @ 2017-03-07 19:29 Zhentiw 阅读(186) 评论(0) 推荐(0) 编辑
摘要:Learn how to create a table using the most widely-used data types (serial, varchar, integer, float, boolean, and date), and the most necessary constra 阅读全文
posted @ 2017-03-06 17:48 Zhentiw 阅读(151) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示