Posts

How to Delete Table with Join Statement

Similar to my previous post on how to update with multiple join statements , this time, I need to delete rows in a table, but with extra criteria which made me need to join the table before deleting the rows. To do this, there are several ways, however, I found this method is the easiest: DELETE A FROM TABLE1 A LEFT JOIN TABLE2 B ON A.ROWID = B.ROWID WHERE A.first_name = 'James' AND B.last_name = 'Bond'

How to UPDATE multiple tables in Microsoft SQL using JOIN query

Sometimes the update query needs to target a complex query and therefore you will need to use this. SQL Syntax: UPDATE      t1 SET      t1.field = value    FROM      t1     [INNER | LEFT] JOIN t2 ON join_predicate    .. WHERE      where_predicate; And MySQL Syntax: UPDATE t1 [INNER | LEFT JOIN] JOIN t2 ON join_predicate SET T1.field = value WHERE condition

Sunrose USB Fingerprint Reader Driver

Image
Also known as the ELAN Smart-id Fingerprint. Steps to resolve: Download the driver  (Tested on Windows 10) Extract the Zip file Go to device management, find ELAN Fingerprint, right-click and select update driver Locate the driver inside the extracted files Let me know in the comment below if you still have any issue(s)

How to get size of each table using SQL Management Studio

Image
Sometimes your DB storage bloated so much, without knowing what caused it. Fortunately, there is an easy way to check using SQL Management Studio (SMSS). In this scenario, I am using SQL Management Studio 18. Open SQL Management Studio and connect to your DB Click View -> Object Explorer (F7) -> Databases From the list of databases, navigate to the DB you want to investigate Right-click on the header of the table list, choose Data Space Used (KB) Click on the Data Space header to sort based on the biggest to lowest data usage. Not surprising, usually the culprit is the log that does not have an auto-delete function.

Direct link to access phpMyAdmin when cPanel is not working

Image
This happened to me today. It looks like the license of my cPanel has run out and I need to access the database in urgent. Luckily the FTP access still working so I can install phpMyAdmin manually that way. However, being a lazy person, I found a quicker and less labour intensive. To open phpMyAdmin without cPanel, you will just need to open this link: http://www.yourdomain.com:2083/3rdparty/phpMyAdmin/index.php Obviously, you need to change yourdomain.com to your correct domain and if your cPanel is on a different port, you need to change the port number as well, but other than that, the link should work.

Enable PHP opcache extension on Windows XAMPP

If your XAMPP comes with PHP 5.5+ by default, opcache already included in the bundle, you will just need to enable it. To enable the extension: Open php.ini (by default it should be located here: C:\xampp\php\php.ini). Add this line at the end of the file: zend_extension = "C:\xampp\php\ext\php_opcache.dll" You will need to adjust the path if you installed XAMPP in non default location. Restart Apache server.

MySQL using Command Line on PC with XAMPP installed

Image
With XAMPP when you have to import a very big mysql table, even though you have increase the script time in php.ini but sometimes it still does not cut the mustard. I found out another way to do this by going through the command line interface. For this example, I am going to use ms-dos in Microsoft Windows, however you can do similar thing with SSH. Navigate to your MySQL folder (by default it should be C:\xampp\mysql\bin) Run mysql.exe with this command: mysql -u yourusername -p yourpassword. Once you are in MySQL interface, then type use dataBaseName . If the dataBase is not set yet, run this command: create database databaseName; After the new database created, type use databaseName; To import, type: source pathToSQLData.  In PC, it will be something like source C:\xampp\htdocs\backup.sql It should start importing your data now. Extra tip: In the command line, you can do all sort of other things that you usually type in phpmyadmin sql section, it will be just faster