2 Ways to Get the Size of a Database in PostgreSQL

January 27, 2022 A Goodman

You can see the size of a whole PostgreSQL database by using the pg_database_size() function or via pgAmin. Using pg_database_size() Login to your Postgres server by using the psql command then execute the following statement: Don’t…

2 ways to rename a database in PostgreSQL

January 27, 2022 A Goodman

This concise article shows you 2 different ways to change the name of a certain database in PostgreSQL. The first method is using the command line and the second one is via pgAdmin. Using Command Line…

How to select a Database to use in PostgreSQL

January 26, 2022 A Goodman

This short article shows you 2 different ways to select a database in PostgreSQL (in MySQL, there is the command use database <database name> but such thing doesn’t exist in the PostgreSQL world). Using psql You…

2 Ways to Show all Databases in PostgreSQL

January 29, 2022 A Goodman

This concise and straightforward article walks you through a couple of different ways to view all databases (on your server) in PostgreSQL. Using psql command The quick way Open a terminal window on your computer then…

PostgreSQL: Create Tables with Auto-Increment IDs

January 24, 2022 A Goodman

This article walks you through 2 different approaches to creating tables with auto-generated primary keys in PostgreSQL. Without any further ado, let’s get in action. Using generated as identity This syntax is available from PostgreSQL 10…

How to Create/Delete a Database with MongoDB Shell

October 2, 2021 A Goodman

This short post demonstrates how to create and drop a MongoDB database by using the command line. Creating a New Database The “use [your database name]” command will create a new database if it doesn’t exist,…

How to Check MongoDB Version on Windows, Mac, and Linux

October 2, 2021 A Goodman

You can see the version of MongoDB installed on your computer or server by using the following command: Here’s the result I get on my Mac after executing the mentioned command: And this’s the output I…

MongoDB: Renaming a Database with Command Line

October 2, 2021 A Goodman

This short post shows you how to change the name of a MongoDB database by using the command line (MongoDB shell). At this time, there are no official out-of-the-box tools from the MongoDB team that can…

SQLite: Select Random Records from a Table

September 12, 2021 A Goodman

In SQLite, you can randomly get one or multiple rows from a table by using the following select statement: Example Let’s say we have a table named users: Column Data Type id INTEGER email TEXT name…

MongoDB: Get a Random Document from a Collection

September 12, 2021 Guest Contributor

This short and straight-to-the-point post shows you how to randomly retrieve single or multiple documents from a collection in your MongoDB database by using the $sample aggregation. 1. To get a random document: If you want…

MongoDB: Import/Export a Database with Command Line

September 12, 2021 A Goodman

If you’re using MongoDB, you can export or import a whole database by using a single command line. All of the collections of that database will be exported/imported at once. It’s super convenient when backup/restore data….

6 Ways to Store Data Offline in Flutter (2023)

February 10, 2023 A Goodman

There are many cases where you need to store data locally on users’ devices instead of using remote cloud servers or APIs. For example, you may need to persist data across app launches or download a…

1 2 3 4 5