Found 4401 Articles for MySQL

Dropping a MySQL Table using NodeJS

Mayank Agarwal
Updated on 27-Apr-2021 09:34:02

483 Views

You can delete an existing table from MySql Database using the "DROP TABLE" statement in Node. Sometimes, we need to delete the whole table, though in corporates it is always advised to archive the tables which are not in used instead of deleting them.While deleting a table, we have two scenarios −Deleting a table if it exists, else throw an errorDeleting the table whether it exists or not.We will discuss both the scenarios here.Before proceeding, please check the following steps are already executed −mkdir mysql-testcd mysql-testnpm init -ynpm install mysqlThe above steps are for installing the Node - mysql dependecy ... Read More

Deleting records in MySQL using Nodejs

Mayank Agarwal
Updated on 27-Apr-2021 09:21:34

562 Views

After insertion, we need to delete records as well. The records should can be deleted based upon an identifier from the database table. You can delete records from table using "DELETE FROM" statement.We can delete the records from MySql DB in two ways −Static Deletion - In this type of deletion, we give a prefixed filter value to deleteDynamic Deletion – In this type of deletion, we ask for an input before deletion and then delete upon its basis.Before proceeding, please check the following steps are already executed −mkdir mysql-testcd mysql-testnpm init -ynpm install mysqlThe above steps are for installing ... Read More

Creating a MySQL table using Node.js

Mayank Agarwal
Updated on 27-Apr-2021 09:17:53

647 Views

Generally, NoSQL databases (like MongoDB) are more popular among the Node developers. However, it totally depends upon your usecase and choice to choose any DBMS from different database options present. The type of databse you choose mainly depends upon one's project's requirements.For example, if you need table creation or real-time inserts and want to deal with loads of data, then a NoSQL database is the way to go, whereas if your project deals with more complex queries and transactions, an SQL database will make much more sense.In this article, we will explain how to connect to a MySQL and then ... Read More

Creating a MySQL Table in NodeJS using Sequelize

Mayank Agarwal
Updated on 27-Apr-2021 09:15:06

2K+ Views

Introduction to SequelizeSequealize follows the promise-based Node.js ORM for different servers like – Postgres, MySQL, MariaDB, SQLite, and Microsoft SQL Server.Following are some of the main features of NodeJS sequelize −Transaction SupportRelationsEager and Lazy LoadingRead Replication and more...Connecting to MySQL using SequelizeWe need to establish a connection between MySQL and Node.js using Sequelize.After creating a successful connection with sequelize, we would require the following three files for configuration. Please carefully create the following files in their respective folders only.SequelizeDemo > application.jsThis will be our root file which will hold the actual logic.SequelizeDemo>utils>database.jsThis will hold all the connection details to MySQL.SequelizeDemo>models>user.jsThis ... Read More

Difference Between ALTER and UPDATE Command in SQL

AmitDiwan
Updated on 15-Apr-2021 07:46:18

2K+ Views

In this post, we will understand the difference between the ALTER command and the UPDATE command in SQL.ALTER CommandThis command is a Data Definition Language (DDL).It performs operation at the structural level, not the data level.This command is used to add, delete, and modify the attributes of the tables in a database.This command, by default, initializes the values of all values in the tuple to NULL.It changes the structure of the table.Syntax: Add a column −ALTER TABLE table_name ADD column_name datatype;Drop a ColumnALTER TABLE table_name DROP COLUMN column_name;UPDATE CommandThis command is a Data Manipulation Language (DML).It performs operations on the ... Read More

Difference Between MySQL and PostgreSQL

AmitDiwan
Updated on 25-Mar-2021 06:28:38

128 Views

In this post, we will understand the difference between MySQL and PostgreSQL.MySQLIt is a relational database management system.It is the product developed by Oracle Corporation.It is supported by Windows, Mac OS X, Linux, BSD, UNIX, z/OS, Symbian, AmigaOS.It can’t be extended.In this system, the phpMyAdmin tool gives the GUI.Mysqldump and XtraBackup provide backup in MySQL.It provides temporary table.It doesn’t provide a materialized view.It doesn’t provide Data Domain Object to the system.PostgreSQLIt is an object-relational database management system.It was developed by the Global Development Group.It is supported by Windows, Mac OS X, Linux and BSD but not by UNIX, z/OS, Symbian, ... Read More

Difference Between Where and Having Clause in SQL

AmitDiwan
Updated on 25-Mar-2021 06:10:10

3K+ Views

In this post, we will understand the difference between WHERE clause and HAVING clause in SQL.WHERE ClauseIt is used to filter the records from the table based on a specific condition.It can be used without the ‘GROUP BY’ clause.It can be used with row operations.It can’t contain the aggregate functions.It can be used with the ‘SELECT’, ‘UPDATE’, and ‘DELETE’ statements.It is used before the ‘GROUP BY’ clause if required.It is used with a single row function such as ‘UPPER’, ‘LOWER’.HAVING ClauseIt is used to filter out records from the groups based on a specific condition.It can’t be used without the ... Read More

Difference Between COMMIT and ROLLBACK in SQL

AmitDiwan
Updated on 25-Mar-2021 05:55:45

1K+ Views

In this post, we will understand the difference between COMMIT and ROLLBACK in SQL.COMMITIt validates the modifications that are made by the current transaction.Once the COMMIT statement has been executed, the transaction can’t be rolled back using ROLLBACK.It occurs when the transaction is successfully executed.SyntaxCOMMIT;ROLLBACKIt removes the modifications that were made by the current transaction.Once ROLLBACK is executed, the database would reach its previous state.This is the state where the first statement of the transaction would be in execution.ROLLBACK happens when the transaction is aborted in between its execution.SyntaxROLLBACK;

Difference Between SQL and T-SQL

AmitDiwan
Updated on 25-Mar-2021 05:40:58

1K+ Views

In this post, we will understand the difference between SQL and T-SQL.SQLIt is a non-procedural language.Relational databases use SQL.It stands for structured query language.It uses query to view and manipulate data.DML and DDL operations are used- Data manipulation language, and data definition language.It is considered as an open-source language.It helps in the manipulation of data and data controlling.Transfer of data happens one by one when SQL is used.T-SQLIt is a Microsoft product.It is known as Transact Structure Query language.It gives a high degree of control to the developers/programmers.It works its best, and provides good performance with Microsoft SQL server.It is ... Read More

What Is the Default MySQL Port Number?

AmitDiwan
Updated on 10-Mar-2021 13:09:00

1K+ Views

MySQL uses port number 3306 by default.3306 Port Number3306 port number is used by MySQL protocol to connect with the MySQL clients and utilities such as ‘mysqldump’. It is a TCP, i.e Transmission Control Protocol.VulnerabilitiesLet us see if there are any vulnerabilities while using this default port −In general, port 3306 shouldn’t be opened since it could make the server vulnerable to attack. If the user needs to connect to the database remotely, there are many other secure options, instead of opening the port 3306.One of the secure options includes using an SSH tunnel. On the other hand, if it ... Read More

Advertisements