Question

write a sql query to export database data to xml in phpmyadmin.

write a sql query to export database data to xml in phpmyadmin.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

Well brother since you are talking about sql query. I would like to tell you that it is not one line query which will output to xml. You need to extract all particular columns through php and write it to xml file for example:

If I have a MySQL database on my website, and I want an XML output via PHP of the following columns in the table:

  1. udid
  2. country
mysql_connect('server', 'user', 'pass');
mysql_select_db('database');

$sql = "SELECT udid, country FROM table ORDER BY udid";
$res = mysql_query($sql);

$xml = new XMLWriter();

$xml->openURI("php://output");
$xml->startDocument();
$xml->setIndent(true);

$xml->startElement('countries');

while ($row = mysql_fetch_assoc($res)) {
  $xml->startElement("country");

  $xml->writeAttribute('udid', $row['udid']);
  $xml->writeRaw($row['country']);

  $xml->endElement();
}

$xml->endElement();

header('Content-type: text/xml');
$xml->flush();

Well, you can do it manully very easily by Clicking the SQL tab. Craft a SQL statement that returns the 'part' of the db that you want exported. Then at the bottom of the page there is a 'Export' button. This will take you to a page that will allow you to export in various formats including XML.

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
write a sql query to export database data to xml in phpmyadmin.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • SQL Server is Microsoft’s popular database engine that uses the Structured Query Language (SQL) to accept...

    SQL Server is Microsoft’s popular database engine that uses the Structured Query Language (SQL) to accept requests for data access. Learn about SQL Server’s backup strategies. Mention the types of data corruption that might occur in an environment using SQL Server. Discuss some database backup requirements that a database administrator should consider when devising a backup strategy for her organization’s DBMS. Describe the different types of backup techniques supported by SQL Server. Conclude by explaining why it is essential to...

  • Database For this lab you will be using SQL SELECT statements to query your database tables....

    Database For this lab you will be using SQL SELECT statements to query your database tables. You will be turning in the results of the following queries: 1. List all Patients and what Bed they are assigned to 2. List all patients who had Treatments and what Treatment they received 3. List all patients who had tests and what Test they had 4. List the employees (doctors, nurses, etc.) who assisted each patient. 5. List all patients in alphabetical order...

  • 2. SQL queries (40 points total, 5 points each query) Write SQL query statements to query...

    2. SQL queries (40 points total, 5 points each query) Write SQL query statements to query the following Hotel Room Booking Database Tables. "cid" is Customer ID. "rid" is Room ID. "bid" is Booking ID. "dob" means Date of Vwwww Birth; "beds" means the number of beds in the room which is normally 1 or 2 beds. "DueDate" and "DueAmount" are the payment due dates and due amounts of this booking. Customers fname name phone email cid dob zipcode Rooms...

  • Write the following query in SQL Suppose a database has the following three relations Movie (mid:...

    Write the following query in SQL Suppose a database has the following three relations Movie (mid: integer, title: string, director: string, relcaseDate: date) PlaysAt (theaterID: integer. movieId:integer. showDate: date) Theater (tID: integer, name: string, phone: string, screencount: integer) movielD" in PlaysAt is a foreign key referencing "mid" in Movie. "theaterlD" in PLaysAt is a foreign key referencing "tID" in Theater.

  • Create a database called COMPANY using those generated SQL scripts in MySQL database. Show the screenshot...

    Create a database called COMPANY using those generated SQL scripts in MySQL database. Show the screenshot of your database and tables in MySQL. To manage your database, you can use the phpmyadmin tool or MySQL Workbench.

  • Please access to TUN SQL/Assistant using the default database = db_pvfc12_std 1.- Run a query to...

    Please access to TUN SQL/Assistant using the default database = db_pvfc12_std 1.- Run a query to retrieve all the data field from db_pvfc12_std in table CUSTOMER_T 2.- Run a query to retrieve record --> CustomerID = 11, How many records did you get and why? 3.- Run a query to retrieve all the data field from table Order_T               Once retrieved:                              3.1.- Please name the fields showing: Primary Key, Foreign Key and other fields                              3.2.- What type of...

  • What is a front-end solution? Building a table such that a query need not write a...

    What is a front-end solution? Building a table such that a query need not write a condition to isolate itself (so you could just dump the contents of a table and it would naturally answer the question) An attempt to manage a database process (usually data entry to a standard) without using database programming techniques in SQL A constraint in SQL only levied when using a query

  • Write a python program on windows which can add data to a my sql database

    Write a python program on windows which can add data to a my sql database

  • Please write SQL Query for following questions using Northwind Database: 1. Create a procedure to add...

    Please write SQL Query for following questions using Northwind Database: 1. Create a procedure to add a new record to Territories table. Call it NewTerr. Add the following records using the procedure. TerritoryID        TerritoryDescription     Region 88888 Brooklyn 1 99999 Waco 4 77777 Long Beach 2 2. Create an Update Procedure that will change the Region from 1 to 3 for record with TerritoryID 88888. Call it Update88. 3. Create a Delete Procedure that will delete the one record from...

  • Intro to database systems: Q7. Formulate the following SQL query in relational algebra using an efficient...

    Intro to database systems: Q7. Formulate the following SQL query in relational algebra using an efficient way. The schema is given in the following. Emp(eno, ename, title, city) Proj(pno, pname, budget, city) Works(eno, pno, since) SELECT ename FROM Works , Emp WHERE Works.pno = ‘P150’ AND Works.eno = Emp.eno

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT