Posts

Showing posts with the label mysql

What is the difference between Mysql and MongoDB?

Image
Many fresher want to ask that what is the diffrence between Mysql and MongoDB? SO here is easy example to describe them: Mysql -> Database -> table->row As you know that Msql have many database and database have many tables and tables have  Rows and Coloumn. MongoDB->database->collection->array Or Json MongoDb has database and database have many collection and collection have array Or Json     RDBMS MongoDB Database Database Table Collection Tuple/Row Document column Field Table Join Embedded Documents Primary Key Primary Key (Default key _id provided by mongodb itself)           Database Server and Client Mysqld/Oracle mongod mysql/sqlplus mongo

Mysql interview question and answer?

1. Define SQL? Answer : SQL stands for Structured Query Language. SQL is a programming Language designed specially for managing data in Relational Database Management System (RDBMS). 2. What is RDBMS? Explain its features? Answer : A Relational Database Management System (RDBMS) is the most widely used database Management System based on the Relational Database model. Features of RDBMS Stores data in tables. Tables have rows and column. Creation and Retrieval of Table is allowed through SQL. 3. What is Data Mining? Answer : Data Mining is a subcategory of Computer Science which aims at extraction of information from set of data and transform it into Human Readable structure, to be used later. 4. What is an ERD? Answer : ERD stands for Entity Relationship Diagram. Entity Relationship Diagram is the graphical representation of tables, with the relationship between them. 5. What is the difference between Primary Key and Unique Key? Answer : Both

Got a packet bigger than 'max_allowed_packet' bytes error in mysql?

Image
 Got a packet bigger than 'max_allowed_packet' bytes error in mysql? Open your my.ini and search max_allowed_packet   and change it to max_allowed_packet = 20 M

Define DDL and DML in my mysql?

Define DDL, DML commands DDL Data Definition Language (DDL) statements are used to define the database structure or schema. examples are: CREATE - to create objects in the database ALTER - alters the structure of the database DROP - delete objects from the database TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed COMMENT - add comments to the data dictionary RENAME - rename an object DML Data Manipulation Language (DML) statements are used for managing data within schema objects. examples are: SELECT - retrieve data from the a database INSERT - insert data into a table UPDATE - updates existing data within a table DELETE - deletes all records from a table, the space for the records remain MERGE - UPSERT operation (insert or update) CALL - call a PL/SQL or Java subprogram EXPLAIN PLAN - explain access path to data LOCK TABLE - control concurrency

How to get date from a timestamp in mysql?

Image
How to get date from a timestamp in mysql? simple you can use FROM_UNIXTIME function and pass the parameter. my table name is  messages like this: SELECT FROM_UNIXTIME(`created`,'%Y-%m-%d') as date FROM `messages`

How to get all record of yesterday from table in mysql?

Image
How to get all record of yesterday from table in mysql? if you are looking for sql query which will return you all record of yesterday. So please take a look on this query and replace the content according to your table Let your table is like this: So your query will be like this select id from tbl_download  WHERE date(download_date) = ADDDATE(current_date,-1) Happy coding :)

How can I to search in mysql within a table of comma-separated values?

I have a MySQL table which contains comma-separated values like 2,4,56,125 and i want to search record which have a particular value. so how can i search in mysql  simple copy and paste this code in your table and change your table name and field name and search keyword. SELECT * FROM table WHERE FIND_IN_SET(search_keyword , field_name)  like SELECT * FROM tbl_font WHERE FIND_IN_SET(2,cat_id)

The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay

The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay if you have long mysql query or many joins and you got this error the use this  SET SQL_BIG_SELECTS = 1 example:  SELECT p.id as project_id,  p.job_number, p.time_to_complete , p.user_id, p.job_name, p.bid_date , p.bid_complete_date, p.service_id, p_docs.link, p_docs.username, p.status,  p_docs.password, p_docs.special_instructions, ord.amount, ord.payment_status, p.createDate , s.service_name , u.contact_name , u.f_number , f.name as franchise_name , v.name as vendor_name ,v.id as vendor_id , s.id as services_id , ord.order_date FROM wte_projects AS p INNER JOIN wte_projects_docs AS p_docs ON p.id = p_docs.project_id INNER JOIN wte_orders AS ord ON p.id = ord.project_id INNER JOIN wte_users AS u ON u.id = p.user_id  LEFT JOIN wte_franchise as f on f.code = u.f_number LEFT JOIN wte_services AS