Saturday , 30 May 2020
Stackode
Home > Tag Archives: MySql

Tag Archives: MySql

Laravel Syntax error or access violation: 1071

laravel-key-too-long

Trying to migrate in Laravel. When run “$ php artisan migrate” get this error : [Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes or Doctrine\DBAL\Driver\PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes or PDOException::("SQLSTATE[42000]: Syntax error or access violation: ...

Read More »

How to delete index in MySql

How to delete index in MySql, first you need to know the exact name of the INDEX (Unique key in this case) to delete or update it. INDEX names are usually same as column names. In case of more than one INDEX applied on a column, MySQL automatically suffixes numbering to the column names to create unique INDEX names. For ...

Read More »

Create Database – SQL

Create Database – SQL statement is used to create new SQL database. Syntax: Basic syntax of CREATE DATABASE statement is as follows: CREATE DATABASE DatabaseName; Always database name should be unique within the RDBMS. Example: If you want to create new database <testDB>, then CREATE DATABASE statement would be as follows: SQL> CREATE DATABASE testDB; Make sure you have admin ...

Read More »

SORTING Results – SQL

SORTING Results – SQL is used to sort the data in ascending or descending order, based on one or more columns. Some database sorts query results in ascending order by default. Syntax: The basic syntax of ORDER BY clause which would be used to sort result in ascending or descending order is as follows: SELECT column-list FROM table_name [WHERE condition] ...

Read More »

Sub Queries – SQL

Sub Queries – SQL or Inner query or Nested query is a query within another SQL query and embedded within the WHERE clause. A subquery is used to return data that will be used in the main query as a condition to further restrict the data to be retrieved. Subqueries can be used with the SELECT, INSERT, UPDATE, and DELETE ...

Read More »

MySQL Database Server

MySQL Database Server – Software database mulai bermunculan seiring dengan bertambahnya kebutuan akan database server. Salah satu dari pendatang baru dalam dunia database ialah MySQL, sebuah server/klien database SQL yang berasal dari Skandinavia. MySQL terdiri atas server SQL, klien program untuk mengakses server, tools untuk administrasi, dan interface program untuk menulis program sendiri. Pengembangan MySQL dimulai pada tahun 1979 dengan ...

Read More »

Drop or Delete Database

Drop or Delete Database statement is used to drop an existing database in SQL schema. Syntax: Basic syntax of DROP DATABASE statement is as follows: DROP DATABASE DatabaseName; Always database name should be unique within the RDBMS. Example: If you want to delete an existing database <testDB>, then DROP DATABASE statement would be as follows: SQL> DROP DATABASE testDB; NOTE: ...

Read More »

Constraints – SQL

Constraints – SQL – Constraints are the rules enforced on data columns on table. These are used to limit the type of data that can go into a table. This ensures the accuracy and reliability of the data in the database. Constraints could be column level or table level. Column level constraints are applied only to one column, whereas table ...

Read More »

Using Sequences – SQL

Using Sequences – SQL is a set of integers 1, 2, 3, … that are generated in order on demand. Sequences are frequently used in databases because many applications require each row in a table to contain a unique value, and sequences provide an easy way to generate them. This chapter describes how to use sequences in MySQL. Using AUTO_INCREMENT ...

Read More »

Select Database, Use Statement – SQL

Select Database, Use Statement – SQL When you have multiple databases in your SQL Schema, then before starting your operation, you would need to select a database where all the operations would be performed. The SQL USE statement is used to select any existing database in SQL schema. Syntax: Basic syntax of USE statement is as follows: USE DatabaseName; Always ...

Read More »