Wednesday , 20 January 2021
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 »

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 »

Using Joins – SQL

Using Joins – SQL is used to combine records from two or more tables in a database. A JOIN is a means for combining fields from two tables by using values common to each. Consider the following two tables, (a) CUSTOMERS table is as follows: +----+----------+-----+-----------+----------+ | ID | NAME | AGE | ADDRESS | SALARY | +----+----------+-----+-----------+----------+ | 1 ...

Read More »

Handling Duplicates – SQL

Handling Duplicates – SQL may be a situation when you have multiple duplicate records in a table. While fetching such records, it makes more sense to fetch only unique records instead of fetching duplicate records. The SQL DISTINCT keyword, which we already have discussed, is used in conjunction with SELECT statement to eliminate all the duplicate records and fetching only ...

Read More »

Create Table – SQL

Create Table – SQL involves naming the table and defining its columns and each column’s data type. The SQL CREATE TABLE statement is used to create a new table. Syntax: Basic syntax of CREATE TABLE statement is as follows: CREATE TABLE table_name( column1 datatype, column2 datatype, column3 datatype, ..... columnN datatype, PRIMARY KEY( one or more columns ) ); CREATE ...

Read More »

UNIONS CLAUSE – SQL

UNIONS CLAUSE – SQL is used to combine the results of two or more SELECT statements without returning any duplicate rows. To use UNION, each SELECT must have the same number of columns selected, the same number of column expressions, the same data type, and have them in the same order, but they do not have to be the same ...

Read More »

Injection SQL

Injection SQL – If you take user input through a webpage and insert it into a SQL database, there’s a chance that you have left yourself wide open for a security issue known as SQL Injection. This lesson will teach you how to help prevent this from happening and help you secure your scripts and SQL statements in your server ...

Read More »

Drop or Delete Table – SQL

Drop or Delete Table – SQL statement is used to remove a table definition and all data, indexes, triggers, constraints, and permission specifications for that table. NOTE: You have to be careful while using this command because once a table is deleted then all the information available in the table would also be lost forever. Syntax: Basic syntax of DROP ...

Read More »

NULL Values – SQL

NULL Values – SQL is the term used to represent a missing value. A NULL value in a table is a value in a field that appears to be blank. A field with a NULL value is a field with no value. It is very important to understand that a NULL value is different than a zero value or a field ...

Read More »