I find your question odd and it doesn't look you fully understand how databases work. You can't name rows of a database, it's simply not even a concept. As for naming columns, that is exactly what you do in your CREATE TABLE statement, you give a name to each column. In your example these are 'Item Id', 'Item number', 'Location', and 'Order'. So you already know how to name these.
If you want to be able to build your CREATE TABLE dynamically from entries in a cell array, then you're going to have to do something to what I showed in your previous question. In your statement, you not only need to dynamically put the names of the row, that's easy to do, but also the types of the rows, that's a lot more complicated if you need to infer that from the cell array itself.
One very rough solution, untested (there may be bugs / typos):
function sql = maketablefromcell(tablename, c)
colsql = cell(1, size(c, 2));
for col = 1:size(c, 2)
if ischar(c{2, col})
coltype = 'varchar';
elseif islogical(c{2, col})
coltype = 'bit';
elseif isnumeric(c{2, col})
allnums = cell2mat(cellfun(@(m) m(:), c, 'UniformOutput', false));
if all(mod(allnums, 1) == 0)
coltype = 'integer';
else
coltype = 'float';
end
else
error('Unrecognised data type for column %d', col);
end
colsql{col} = sprintf('%s %s', c{1, col}, coltype);
end
sql = sprintf('CREATE TABLE %s (%s)', tablename, strjoin(colsql, ','));
end