Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Using format specifiers for extracting data from sqlite database file

조회 수: 1 (최근 30일)
Sushanth Manchikatla
Sushanth Manchikatla 2020년 8월 1일
마감: MATLAB Answer Bot 2021년 8월 20일
In the given code snippet, what should be done at the "?" to get the details mentioned in the query from a table BIO in the database file database.db?
I need to place name (John) at the question mark. What should be done to get the result?
(No element in the database table is NULL)
con = sqlite('database.db');
name = "John";
sqlquery = "SELECT AGE,EMAIL,EDUCATION FROM BIO WHERE NAME == ?";
result = fetch(con,sqlquery);

답변 (1개)

Jalaj Gambhir
Jalaj Gambhir 2020년 8월 25일
편집: Jalaj Gambhir 2020년 8월 25일
Hi,
Have a look at the answer here. You have to create a string using square brackets to concatenate the variable with the remaining query.
Hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by