Category Archives: SQ L& MYsql

Getting the following error while import sql file in phpmyadmin.

Fatal error: Out of memory (allocated 998506496) (tried to allocate 496760462 bytes)phpMyAdmin\libraries\import.lib.php on line 373 Step1:Copy the .sql file into the xammp folder in the below path xampp/mysql/bin Step2:create a database called testdatabase in phpmyadmin step3: Execute the below command through command prompt C:\xampp\mysql\bin>mysql -u root -D testdatabase < db_dump_db.sql

How to copy a table from one database to another database including structure and data in mysql

There are different options for copying table from one database to another database. Two methods i m giving here 1.In phpmyadmin one option is there to copy tables.Phpmyadmin if you go to operations tab->copy database to using the below options using a checkbox. Structure only Structure and data Data only CREATE DATABASE before copying Add… Read More »

Column ’emp_id’ in IN/ALL/ANY subquery is ambiguous

Below query execution throwing the error Column ’emp_id’ in IN/ALL/ANY subquery is ambiguous select employees.emp_id,emp_reg_date from employees join emp_linking_table on emp_linking_table.emp_id=employees.emp_id where emp_id not in( select emp_id from data_record_table) solution: if you change condition like as below will give proper result where employees.emp_id not in( select emp_id from data_record_table)

CASE When Not working with varchar (default value null) in mysql.. please check the solution

create a table using the below sql statement

if we use the below mysql query output as like below

you can see the result with NULL value for the first_name field. if you use the query as in a newformat ..with IFNULL condition it wil work. below query will work for you SELECT… Read More »

How to join the below two table using Joins

Below are the two database tables tbl_questions

tbl_answer

tbl_questions tbl_answer Output would be like this i need to get ouput as above, anybody is there to help. please comment….

Count of multiple fields in a join query in mysql

This is the query i used to fetch count of multiple fields from my table.I used four times select query inside a query before doing join

you can see the database structure and query result as below

Trigger Execution examples in mysql

We have two database tables. while updating the table entry trigger will execute. tbl_experience tbl_salary after updating the experience in the tbl_experience table. automaticaly update the salary column in the tbl_salary Step1: Use the below code to create tables through phpmyadmin-paste the below code into the query window.

Step2: execute the below script through… Read More »

IS NULL usage in mysql-php

Example: we have two tables tbl_students,tbl_marks using a join query to fetch the students not having records in marks table.It should work using a single query see the blow example without using subquery. For creating students and marks table use the below query

use the below query to display null records