MySQL: Cloning a MySQL database on the same MySql instance

As the manual says in Copying Databases you can pipe the dump directly into the mysql client: If you’re using MyISAM you could copy the files, but I wouldn’t recommend it. It’s a bit dodgy. Integrated from various good other answers Both mysqldump and mysql commands accept options for setting connection details (and much more), like: Also, if the new database is not … Read more

How to connect to a local database in SQL Server Management Studio?

You need to download and install SQL LocalDB. It is a special edition of SQL Server that does not allow remote connection and supports windows integrated authentication only. It is a simple one click MSI install so it is easy to deploy. To download and install SQL Server 2016 Express, go to SQL Server downloads. LocalDB is a … Read more

Check if an object exists

Since filter returns a QuerySet, you can use count to check how many results were returned. This is assuming you don’t actually need the results. After looking at the documentation though, it’s better to just call len on your filter if you are planning on using the results later, as you’ll only be making one sql query: A count() call … Read more

importing a CSV into phpmyadmin

In phpMyAdmin, click the table, and then click the Import tab at the top of the page. Browse and open the csv file. Leave the charset as-is. Uncheck partial import unless you have a HUGE dataset (or slow server). The format should already have selected “CSV” after selecting your file, if not then select it … Read more

Difference between rake db:migrate db:reset and db:schema:load

db:migrate runs (single) migrations that have not run yet. db:create creates the database db:drop deletes the database db:schema:load creates tables and columns within the existing database following schema.rb. This will delete existing data. db:setup does db:create, db:schema:load, db:seed db:reset does db:drop, db:setup db:migrate:reset does db:drop, db:create, db:migrate Typically, you would use db:migrate after having made changes to the schema via new migration … Read more

what is the difference between triggers, assertions and checks (in database)

Triggers – a trigger is a piece of SQL to execute either before or after an update, insert, or delete in a database. An example of a trigger in plain English might be something like: before updating a customer record, save a copy of the current record. Which would look something like: The difference between … Read more