Found 4378 Articles for MySQL

Best way to test if a row exists in a MySQL table

Ankith Reddy
Updated on 06-Sep-2023 21:41:54

41K+ Views

To test whether a row exists in a MySQL table or not, use exists condition. The exists condition can be used with subquery. It returns true when row exists in the table, otherwise false is returned. True is represented in the form of 1 and false is represented as 0.For better understanding, firstly we will create a table with the help of CREATE command. The following is the query to create a table −mysql> CREATE table ExistsRowDemo -> ( -> ExistId int, -> Name varchar(100) -> ); Query OK, 0 rows affected (0.53 sec)After creating the table successfully, we will ... Read More

MySQL Error - #1046 - No database selected

Arjun Thakur
Updated on 24-Jun-2020 13:56:06

21K+ Views

The error-#1046 can occur when we are creating a table, but forget to select the database. Let us say we have started MySQL as shown below −After giving the correct password, the above window will open. Now create a table without choosing any database. This will show an error −mysql> CREATE table TblUni -> ( -> id int, -> Name varchar(100) -> );ERROR 1046 (3D000): No database selectedThe following screenshot is showing the same error −Now, choose any database to get rid of the above error. Firstly, let us check how many databases are present in MySQL with the help ... Read More

How to take backup of a single table in a MySQL database?

George John
Updated on 30-Jul-2019 22:30:23

543 Views

The backup of a table can be made with the help of backup table as well as mysqldump utility. The backup table concept was used in MySQL version 5.0 and its earlier version. Here, I am performing backup with the help of mysqldump. Firstly, we will open cmd with the help of shortcut key. The mysqldump will run at the cmd. Therefore, firstly open cmd with the help of shortcut key − windowskey+R; Here is the snapshot − Now, cmd will open − In this, the MySQL bin folder is present at the following location − ... Read More

N-ary Relationship in Database

Amit Diwan
Updated on 20-Jun-2020 09:52:14

10K+ Views

A relationship is an important part of any Entity relationship diagram as it shows the relation between two different entities. In an n - ary relationship, the n shows the number of entities in the relationship. It can be anything but the most popular relationships are unary, binary and ternary where the number of entities respectively are one, two and three.More information about Unary, Binary and Ternary relationships is as follows −Unary RelationshipWhen there is a relationship between two entities of the same type, it is known as a unary or recursive relationship. This means that the relationship is between ... Read More

Centralized Database Management System

Alex Onsman
Updated on 20-Jun-2020 09:53:33

16K+ Views

A centralized database is stored at a single location such as a mainframe computer. It is maintained and modified from that location only and usually accessed using an internet connection such as a LAN or WAN. The centralized database is used by organisations such as colleges, companies, banks etc.As can be seen from the above diagram, all the information for the organisation is stored in a single database. This database is known as the centralized database.AdvantagesSome advantages of Centralized Database Management System are −The data integrity is maximised as the whole database is stored at a single physical location. This ... Read More

Security, Integrity and Authorization in DBMS

Kristi Castro
Updated on 20-Jun-2020 09:53:55

14K+ Views

Database SecurityDatabase security has many different layers, but the key aspects are:AuthenticationUser authentication is to make sure that the person accessing the database is who he claims to be. Authentication can be done at the operating system level or even the database level itself. Many authentication systems such as retina scanners or bio-metrics are used to make sure unauthorized people cannot access the database.AuthorizationAuthorization is a privilege provided by the Database Administer. Users of the database can only view the contents they are authorized to view. The rest of the database is out of bounds to them.The different permissions for ... Read More

Concurrency Control Using Locks in DBMS

David Meador
Updated on 20-Jun-2020 09:43:06

12K+ Views

Locks are an integral part to maintain concurrency control in DBMS. A transaction in any system implementing lock based concurrency control cannot read or write a statement until it has obtained the required locks.There are two types of locks in Lock based protocols. These are:Binary Locks - These can only be in one of two states, locked or unlocked.Shared/Exclusive Locks - Shared locks are acquired when only read operation is to be performed. Shared locks can be shared between multiple transactions as there is no data being altered. Exclusive locks are used when write operation is performed. Only the transaction holding the ... Read More

DDBMS Components

Ricky Barnes
Updated on 20-Jun-2020 08:48:53

4K+ Views

The contents of a distributed database are spread across multiple locations. That means the contents may be stored in different systems that are located in the same place or geographically far away. However, the database still appears uniform to the users i.e the fact that the database is stored at multiple locations is transparent to the users.The different components of a distributed database are −Let us now discuss them one by one −UsersThere are many users who use the distributed database. For them, the fact that the database is spread across multiple locations is transparent and they perceive the database ... Read More

DDBMS Advantages and Disadvantages

David Meador
Updated on 20-Jun-2020 08:18:55

16K+ Views

The distributed database management system contains the data in multiple locations. That can be in different systems in the same place or across different geographical locations.As shown in the below example −The database is divided into multiple locations and stores the data in Site1, Site2, Site3 and Site4.The advantages and disadvantages of Distributed database management systems are as follows −Advantages of DDBMSThe database is easier to expand as it is already spread across multiple systems and it is not too complicated to add a system.The distributed database can have the data arranged according to different levels of transparency i.e data ... Read More

Unary or Recursive Relationship

Amit Diwan
Updated on 20-Jun-2020 08:19:28

5K+ Views

When there is a relationship between two entities of the same type, it is known as a recursive relationship. This means that the relationship is between different instances of the same entity type.Some examples of recursive relationship can be shown as follows −An employee can supervise multiple employees. Hence, this is a recursive relationship of entity employee with itself. This is a 1 to many recursive relationship as one employee supervises many employees.A person can have many children who are also persons. Hence, this is a recursive relationship of entity person with itself. This is a 1 to many recursive ... Read More

Advertisements